[issue10101] a bug in built-in function round() ?
Retro
report at bugs.python.org
Thu Oct 14 17:18:43 CEST 2010
Retro <vinetouu at gmail.com> added the comment:
Gee, thanks for the insight. I didn't thought about the fact that binary floating point is so imprecise and can cause the round() to "error" in some situations.
In this case, the representation and the actual value are (way) off. How can that be? There are just 3 decimal numbers (.255) and Python at parsing the float is already off at the third decimal number. I'll never trust round() again. Well, actually I trust round() to do its job well -- it's the binary floating point I'm affraid of!
We must implement the decimal API to the core of Python in order to have precision.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10101>
_______________________________________
More information about the Python-bugs-list
mailing list