Precision issue

Terry Reedy tjreedy at udel.edu
Fri Oct 10 20:13:50 EDT 2003


"Cameron Laird" <claird at lairds.com> wrote in message
news:vodvspiogmil0f at corp.supernews.com...
> In article <Ooicne5U3dhZdhuiU-KYgg at comcast.com>,
> Terry Reedy <tjreedy at udel.edu> wrote:
> >It is for decimally representing, as precisely as possible *with 17
> >digits*, the actual value.  I presume that 17 in the minimum
necessary
> >to guarantee a unique, back-convertible prepresentation for every
> >float.

> Stuff in this area is difficult to express precisely.  I'm
> not sure what your, "I presume that ..." means.  Here's one
> way to think about that magic number:  there are "floats"
> which are distinct, but agree to sixteen (decimal-)digits
> of accuracy.

That is what I meant.  16 digits is not enough for binary float=>
decimal rep to be one-to-one

> Some (seventeen-digit) decimals canNOT be achieved through
> a round trip.

 If you mean s != (sometimes) repr(eval(s)), of course; there are (I
believe) fewer than 10**17 floats (ignoring exponents), so mapping in
that direction cannot be onto.  This is the fundamental problem; for
any positive number of bits and decimals, the two sets have different
sizes.

Terry J. Reedy






More information about the Python-list mailing list