Python can't divide??!?!
Christoph Pingel
ch.pingel at web.de
Thu Feb 5 13:00:00 EST 2004
Same here, on Mac OS 9:
Python 2.3 (#155, Jul 30 2003, 23:48:32) [CW] on mac
Type "copyright", "credits" or "license" for more information.
>>> 2.4/4
0.59999999999999998
>>>
>3 / 5 0 Fair enough, int / int = int
>3 / 5.0 0.59999999999999998 eh?
>3.0 / 3 0.59999999999999998 ummmm...
>3.0 / 5.0 0.59999999999999998 how did I guess...
>
>That's just an example. Python cannot divide. Period. If you try 1.0 / 3 you
>get 0.33333333333333331, and from this, the above example, and a few tests,
>I speculate that *something* is subtracting 2 from the last digit *after*
>the division is done.
>
>Wacky.
More information about the Python-list
mailing list