Am 22.02.2012 19:13, schrieb Alec Taylor: > Simple mathematical problem, + and - only: > >>>> 1800.00-1041.00-555.74+530.74-794.95 > -60.950000000000045 > > That's wrong.
That's only the correct answer for unlimited precision, not for IEEE-754 semantics. http://en.wikipedia.org/wiki/IEEE_754 > Proof > http://www.wolframalpha.com/input/?i=1800.00-1041.00-555.74%2B530.74-794.95 > -60.95 aka (-(1219/20)) > > Is there a reason Python math is only approximated? - Or is this a bug? Python uses the platforms double precision float datatype. Floats are almost never exact. Christian -- http://mail.python.org/mailman/listinfo/python-list