[Python-Dev] Expert floats (original) (raw)

Andrew Koenig ark-mlist at att.net
Tue Apr 6 11:09:37 EDT 2004


I believe Ping would have

>>> 2.20 - 1.20 1.0000000000000002

As would I.

because "1.0000000000000002" is the shortest string that evals to the true machine result. OTOH, he'd have

>> 2.20 - 1.10 1.1

Believe it or not, this apparent anomaly doesn't bother me, but

1.1 1.1000000000000001

does. The reason is that the first example does arithmetic, and it is easy to explain that floating-point arithmetic is not completely accurate.



More information about the Python-Dev mailing list