On Mon, Mar 19, 2007 at 03:04:03AM -0700, Dick Moores wrote: > Yesterday I was shocked, SHOCKED, to discover that round() is > occasionally rounding incorrectly. For example,
"Garbage In, Garbage Out" :-) Floating point numbers in Python (and other computer languages) are only an approximation: >>> print round(0.145, 2) 0.14 >>> 0.145 0.14499999999999999 >>> print round(0.1450000001, 2) 0.15 http://docs.python.org/tut/node16.html has some more information about this. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor