This math scares me

Werner Schiendl ws-news at
Tue Mar 13 10:25:39 CET 2001

I wonder why 17 digits are used to represent the numbers...
Think I can remember the precision of double was 15 to 16 decimal digits
(depends on the value)

Did I miss something?


Tim Peters < at> wrote in message
news:mailman.984458537.14769.python-list at
> [Andrew Koenig]
> > I'm curious -- Does Python now follow either the IEEE or the more
> > restrictive Scheme rules for floating-point conversion?
> > ...
> All aspects of Python fp are inherited from whatever the platform C
> and libraries happen to do.  repr() conversion to string uses the platform
> sprintf's %.17g format; str() conversion %.12g; both are fiddled just a
> little to ensure that an exponent or a decimal point (or both) appears.
> string->float is a x-platform adventure, since some platforms can't read
> all the C doubles they print (thinking of infinities and NaNs here);
> inherits that too, whenever it happens.
> it's-all-x3j11's-fault<wink>-ly y'rs  - tim

More information about the Python-list mailing list