[issue41513] Scale by power of two in math.hypot()

Tim Peters report at bugs.python.org
Tue Aug 18 23:46:08 EDT 2020


Tim Peters <tim at python.org> added the comment:

Here's a "correct rounding" fail for the add_on approach:

xs = [16.000000000000004] * 9

decimal result = 48.00000000000001065814103642
which rounds to float 48.000000000000014

add_on result: 48.00000000000001

That's about 0.5000000000026 ulp too small - shocking ;-)

The fsum approach got this one right, but has similar failures on other inputs of the same form; i.e.,

    [i + ulp(i)] * 9

for various integers `i`.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41513>
_______________________________________


More information about the Python-bugs-list mailing list