Why is 2.3 = 2.2999999999999998 ?

Arne Koewing ark at gmx.net
Fri Jan 24 00:11:47 CET 2003


my puthon installation seems to ce confused about floats...

>>> 2.1
2.1000000000000001
>>> 2.2
2.2000000000000002
>>> 2.3
2.2999999999999998
>>> 2.4
2.3999999999999999
>>> 2.5
2.5
>>> 2.6
2.6000000000000001
>>> 

 this happens on debian/sid

Python 2.2.2 (#1, Jan 18 2003, 10:18:59) 
[GCC 3.2.2 20030109 (Debian prerelease)] on linux2

and also
Python 2.1.3+ (#1, Jan 18 2003, 09:26:15) 
[GCC 3.2.2 20030109 (Debian prerelease)] on linux2

any ideas? 

Arne




More information about the Python-list mailing list