floating point mystery

Opinderjit bhellao at my-deja.com
Sat Sep 23 12:47:00 EDT 2000


Why does the following happen on the Windows version of Python? There
must be a reason for this. Does anybody know?
I am not sure if this happens on any other platform.

Version 1.5.2 is as I would expect.
>>> 8572.85
8572.85

Version 1.6, why a '4' at the end
>>> 8572.85
8572.8500000000004

Version 2.0b, why a '4' at the end
>>> 8572.85
8572.8500000000004

Also on version 1.6,
>>> 1.23
1.23
>>> 2.23
2.23
>>> 3.23
3.23
>>> 4.23
4.2300000000000004


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list