[issue13060] make round() floating-point errors less hurtful

Arne Babenhauserheide report at bugs.python.org
Thu Sep 29 17:25:32 CEST 2011


Arne Babenhauserheide <arne_bab at web.de> added the comment:

If the C accelerator for decimal gets decimal performance close to floats (which I doubt, because it has to do much more), it could be very useful for me. What is its estimated time to completion?

Even when it is finished, it does not change the problem that round(0.5, 0) gives mathematically wrong results, so python requires hacks to be correct in this very simple case - instead of being right for most of the simple cases and only get it wrong in corner cases.

My hack isn’t really clean, though, because it depends on the internal representation of floats in the hardware. A real fix would have to get the real size of floats and adjust the added value accordingly.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13060>
_______________________________________


More information about the Python-bugs-list mailing list