[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Binary128 - PI and E



The current proposed specification in COBOL for the intrinsic function PI under standard-binary arithmetic (which follows the rules for IEEE Std 754-2008 binary128 format) is the arithmetic _expression_ (16,312,081,666,030,376,401,667,486,162,748,272 / (2 ** 112)). 
 
What I personally like about that is this: 
1)  The dividend is an integer that completely and exactly specifies the binary content of the significand field (including the implicit leading bit being set)
2)  The divisor is an integer that completely and exactly specifies the binary content of the exponent field after bias is applied.  
 
Although it's not obvious, there's no need for the application of arithmetic operations to produce this value -- assuming a datum of binary128 format, the significand bit-pattern is set to the binary integer representation of the dividend, and the exponent bit-pattern is set to the negative of the power specified in the divisor _expression_.  This, it seems to me, is the closest one can come using decimal numbers to an EXACT representation of PI. 
 
The question is, whether this value is the CLOSEST approximation to PI that can be represented in binary128 format, and that basically means "is the last digit of the integer correct?". 
 
   -Chuck Stevens
 
 


 

> Date: Wed, 11 May 2011 23:06:30 +0200
> From: 7_born@xxxxxx
> To: stds-754@xxxxxxxxxxxxxxxxx
> Subject: Fwd: Re: Binary128 - PI and E
>
> -------- Original-Nachricht --------
> Betreff: Re: Binary128 - PI and E
> Datum: Wed, 11 May 2011 23:03:32 +0200
> Von: Thorsten Siebenborn <7_born@xxxxxx>
> An: William M Klein <wmklein@xxxxxxxxxxxxx>
>
> Am 11.05.2011 21:27, schrieb William M Klein:
> > This may be a stupid question and I don't know if I am even expre4ssing it correct, BUT Can anyone tell me or point me to some place that documents what the exact DECIMAL fixed-point value would be for the most accurate values of PI and E that can be stored in a binary128 data item? Would this just be (for PI) PI with 35 digits to the right of the decimal point?
>
> The quad-precision format (binary128) has with the implicit hidden bit
> 113 bit stored which is for pi equivalent to
>
> 11.0010010000111111011010101000100010000101101000110000100011010011000100
> 11000110011000101000101110000000110111000
>
> This is nearly 0,25 ulps lower than the correct value.
>
> The correctly rounded value is
> 3.1415926535897932384626433832795028
>
> *Exact* conversion binary to decimal (with garbage
> digits due to conversion)
> 3.141592653589793238462643383279502797479068098137295573004504331874296718662975536062731407582759857177734375
>
>
> Bit equivalent for e:
>
> 10.1011011111100001010100010110001010001010111011010010101001101010101111
> 11011100010101100010000000100111001111010
>
> Nearly 0,49 ulps lower than the correct value.
>
> Correctly rounded value:
> 2.7182818284590452353602874713526623
>
> *Exact* conversion binary to decimal (with garbage
> digits due to conversion)
>
> 2.71828182845904523536028747135266231435842186719354886266923086032766716801933881697550532408058643341064453125
>
>
> Best regards,
> Thorsten

754 | revision | FAQ | references | list archive