Python doesn't know how to do math?

Martijn Faassen m.faassen at vet.uu.nl
Thu Apr 25 18:44:46 EDT 2002


Chris Spencer <clspence at one.net> wrote:
>        I tested this using the Python command interpreter on a Windows XP box
> running:
> Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
>>>> float(5)/float(100)
> 0.050000000000000003
>>>> 5.0/100.0
> 0.050000000000000003

>        Okay, I might not be a math genius, but this is most definately WRONG.
> What gives?  Anyone have insight into this little "feature" of Python floating
> point operations?

Heh. The timbot will be with you shortly. If you're impatient, do a 
google groups search and find things like this:

http://groups.google.com/groups?hl=en&selm=000501be0ac4%2433c3f2a0%2418a22299%40tim&rnum=4

http://groups.google.com/groups?q=IEEE+group:comp.lang.python+author:Tim+author:Peters&start=10&hl=en&scoring=d&selm=mailman.991512844.1883.python-list%40python.org&rnum=11

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list