Weird arithmetic in Python
yminsky at cs.cornell.edu
yminsky at cs.cornell.edu
Sun Oct 29 17:39:17 EST 2000
Can anyone explain the following behavior of Python? I understand that
floating point arithmetic is not identical to real arithmetic, but this
seems a bit odd.
Python 1.5.2 (#1, Aug 25 2000, 09:33:37) [GCC 2.96 20000731
(experimental)] on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> .1 * 2 - .2
0.0
>>> .1 * 3 - .3
5.55111512313e-17
>>>
Yaron Minsky
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list