[clean-list] Re: (clean-list digest:) Functions that look the same (smithll)

Richard A. O'Keefe ok@atlas.otago.ac.nz
Wed, 25 Jul 2001 14:17:54 +1200 (NZST)


Siegfried Gonzi <siegfried.gonzi@kfunigraz.ac.at> wrote
in some puzzlement about floating point numbers.

Let's do some arithmetic.
An IEEE-754 double precision floating point number has
 - 1 sign bit
 - 11 (biased) exponent bits
 - 52 significand bits
The representation uses a hidden bit, so we effectively have
53 bits of precision.
2**53 = 9,007,199,254,740,992         15
The precision is thus one part in 9x10  .
So an IEEE 754 double gives you about 16 decimal digits worth.
To convert such a number to decimal so that it will be read back
correctly takes a few more digits, but that's not the precision.

The C header <float.h> is likely to tell you DBL_DIG = 15, because
that's the largest number of decimal digits guaranteed to fit, but
there's nearly a whole 'nother digit in there.