Python can't divide??!?!

Kurt B. Kaiser kbk at shore.net
Fri Feb 6 09:58:50 EST 2004


"Dan Williams" <dan at ithium.net> writes:

> Fire up python or whatever.
>
> Do this:     Result:
>
> 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...
>

>>> print 3.0 / 5
0.6
>>> print (3.0 / 5)
0.6
>>> print (3.0 / 5, 3.0 / 5)
(0.59999999999999998, 0.59999999999999998)
>>> 

[...]

> Wacky.

:-)

-- 
KBK



More information about the Python-list mailing list