Dict handling of floats

Tim Peters tim_one at email.msn.com
Thu Apr 24 23:30:43 EDT 2003


[Jim Richardson]
> I have come across a weirdness. I have a number of floats, (lat long
> pairs) which I stuff into a dict, but when I take them out, my nice %2f4
> number, (say, 47.5894) is something long and *almost* right, like
> 47.589333333333333339. What gives? I am not doing anything special as
> far as I can tell, just stuffing the numbers into a dict, and recalling
> it later. This is with Python 2.2 on Linux, and no, it's not an original
> Pentium :)

> ...
> Linux, because eventually, you grow up enough to be trusted with a fork()

OTOH, I'm not sure anyone grows up enough to be trusted with a float <wink>:

    http://www.python.org/doc/current/tut/node14.html






More information about the Python-list mailing list