weird math errors in python 2.1.1

andrew andrew at mail.idrive.com
Wed Aug 29 22:27:14 CEST 2001


in interactive interpreter, i get these results:

>>> 21.0 /5
4.2000000000000002
>>> 22.0 /5
4.4000000000000004
>>> 23.0/5
4.5999999999999996
>>> 24.0/5
4.7999999999999998
>>>


21.0/5 should be 4.2
22.0/5 should be 4.4
23.0/5 should be 4.6
24.0/5 should be 4.8


other double/int operations resolve correctly (e.g., 26.0/6)

i'm not sure, but i think i'm only seeing this with double/5 operations

anyone else seeing this?  is this a known bug?



More information about the Python-list mailing list