Python doesn't know how to do math?
Bjorn Pettersen
BPettersen at NAREX.com
Thu Apr 25 18:36:08 EDT 2002
> From: Chris Spencer [mailto:clspence at one.net]
>
> 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?
http://www.python.org/doc/current/tut/node14.html
Wrong-is-in-the-eye-of-the-representation'ly y'rs
-- bjorn
More information about the Python-list
mailing list