[EMAIL PROTECTED] wrote:
Hi,
I am new to python.  I was messing around in the interperator checking
out the floating point handling and I believe I may have found a
rounding bug:

234 - 23234.2345
-23000.234499999999


This is not correct by my calculations.

I am using python 2.5.2 in ubuntu 8.04.  I am wondering if this is a
known bug, or if I am just not understanding some feature of python.
Thanks for the help!

-Cooper Quintin
http://www.bitsamurai.net


If you need to round before you display the result, I find the following works:

>>> '%.4f' % (234 - 23234.2345)
'-23000.2345'

The %.4f means that the interpolated value will be treated as a float, rounded to 4 digits after the decimal point.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to