Floating numbers

Christian Heimes lists at cheimes.de
Thu Aug 12 23:30:54 CEST 2010


> Is there a way I can keep my floating point number as I typed it? For
> example, I want 34.52 to be 34.52 and NOT 34.5200000002.

This isn't a Python issue. Python uses IEEE 754 [1] double precision
floats like most other languages. 34.52 can't be stored in a float. The
next valid float is 34.5200000002.

Christian

[1] http://en.wikipedia.org/wiki/IEEE_754




More information about the Python-list mailing list