This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients mark.dickinson, rhettinger, serhiy.storchaka, tim.peters
Date 2020-08-18.08:43:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1597740215.3.0.203170076523.issue41513@roundup.psfhosted.org>
In-reply-to
Content
Hmm, I tried-out a C implementation and the timings weren't bad, 60% slower in exchange for always being correctly rounded.  Do you all think that would be worth it?

# New correctly rounded
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.5, 0.3, 5.2)'
2000000 loops, best of 11: 101 nsec per loop
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.81)'
5000000 loops, best of 11: 82.8 nsec per loop

# Current baseline for Python 3.10
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.5, 0.3, 5.2)'
5000000 loops, best of 11: 65.6 nsec per loop
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.81)'
5000000 loops, best of 11: 56.6 nsec per loop

# Current baseline for Python 3.9
$ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.5, 0.3, 5.2)'
5000000 loops, best of 11: 72.2 nsec per loop
~/npython $ ./python.exe -m timeit -r11 -s 'from math import hypot' 'hypot(1.7, 15.81)'
5000000 loops, best of 11: 56.2 nsec per loop
History
Date User Action Args
2020-08-18 08:43:35rhettingersetrecipients: + rhettinger, tim.peters, mark.dickinson, serhiy.storchaka
2020-08-18 08:43:35rhettingersetmessageid: <1597740215.3.0.203170076523.issue41513@roundup.psfhosted.org>
2020-08-18 08:43:35rhettingerlinkissue41513 messages
2020-08-18 08:43:34rhettingercreate