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

*To*: Charles Stevens <charles.stevens@xxxxxxxx>*Subject*: Re: Binary128 - PI and E*From*: Eric Postpischil <stds-754+ieee.org@xxxxxxx>*Date*: Wed, 11 May 2011 22:09:43 -0400*Cc*: IEEE 754 <stds-754@xxxxxxxxxxxxxxxxx>*In-reply-to*: <COL112-W48A245E60FB737FB19F08183860@phx.gbl>*List-help*: <http://listserv.ieee.org/cgi-bin/wa?LIST=STDS-754>, <mailto:LISTSERV@LISTSERV.IEEE.ORG?body=INFO%20STDS-754>*List-owner*: <mailto:STDS-754-request@LISTSERV.IEEE.ORG>*List-subscribe*: <mailto:STDS-754-subscribe-request@LISTSERV.IEEE.ORG>*List-unsubscribe*: <mailto:STDS-754-unsubscribe-request@LISTSERV.IEEE.ORG>*References*: <4DCAFA56.1020402@gmx.de> <COL112-W48A245E60FB737FB19F08183860@phx.gbl>*Sender*: stds-754@xxxxxxxx

On May 11, 2011, at 19:33, Charles Stevens wrote:

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. ... 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?".

The most significant bit of π * 2**112 is 2**113. The binary128 format provides 113 bits for normal numbers (including the implicit bit), so the least significant bit it provides in π * 2**112 is 2**1, or 2. So the question is would increasing or decreasing the numerator by 2 make the fraction closer to π? π * 2**112 is 16312081666030376401667486162748272.450266..., so making the numerator ...274 or ...270 would make the fraction farther from π. I do not see why the exponent 112 is attractive, though. The exponent will be 1, since π is 1.something * 2**1. The biased exponent encoding will be 1 plus the bias = 1 + 16383 = 16384. And in π * 2**112, the least significant representable bit is 2. I can see how 111 would be attractive, since all the integer bits in π * 2**111 would be representable in the significand of a binary128 object. Unless I slipped by one somewhere? On May 11, 2011, at 15:27, William M Klein wrote:

... 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

As Thorsten Siebenborn wrote, the exact value of the binary128 number that is closest to π is exactly 3.141592653589793238462643383279502797479068098137295573004504331874296718662975536062731407582759857177734375.

Would this just be (for PI) PI with 35 digits to the right of the decimal point?

Yes for π but no in general. Suppose you have 35 digits to the right of the decimal point in the decimal representation of some number, but you do not know what the remaining digits are. The representable floating-point numbers, starting with 2 and counting upward, are 2, 2.000...00038,51... (where the "," marks the spot between the 35th and 36th digits), 2.000...00077,03..., 2.000...00115,55..., and so on. Now, suppose x rounded to 35 decimal places is 2.000...00116. This tells you x is between 2.000...00115,5 and 2.000...00116,5. Some of the numbers in that interval are below 2.000...00115,55 and some are above it. So knowing x to 35 decimal places does not give you enough information to know which 128-bit floating-point number is closest to x. Some number theory can be used to find where the representable numbers most closely approach decimal values, and that would tell you how many decimal digits you need in the worst case. However, I have run out of time for tonight.

(I think that I am correct that any decimal item that can be stored in a binary128 item CAN be expressed exactly as a decimal fixed-point number - although the reverse is not true)

Yes, every value of a finite non-NaN binary128 is an integer multiple of 2**-16494 (the value of the least significant bit of a denormal), and 2**-16494 is an integer multiple of 10**-16494, so every finite non-NaN binary128 can be expressed exactly with at most 16494 decimal places (to the right of the decimal point). — edp (Eric Postpischil) http://edp.org Space isn't remote at all. It's only an hour's drive away if your car could go straight upwards. — Fred Hoyle

**Follow-Ups**:**ISO/IEC/IEEE 60559:2011***From:*Mike Cowlishaw

**Re: Binary128 - PI and E***From:*Eric Postpischil

**Re: Binary128 - PI and E***From:*Rick Regan

**References**:**Fwd: Re: Binary128 - PI and E***From:*Thorsten Siebenborn

**RE: Binary128 - PI and E***From:*Charles Stevens

- Prev by Date:
**RE: Binary128 - PI and E** - Next by Date:
**Four questions on ISO/IEC/IEEE 60559:2011 relative to IEEE Std 754-2008** - Previous by thread:
**RE: Binary128 - PI and E** - Next by thread:
**Re: Binary128 - PI and E** - Index(es):