-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-41513: Save unnecessary steps in the hypot() calculation #21994
New issue 8000
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Almost. The stronger pre-condition |
@rhettinger: Please replace |
|
Reasoning for the assertion:
1.0
.2**-27
.2**-54
.2**-54 < float_info.epsilon
csum >= 1.0
andlo ** 2 < float_info.epsilon
, we havecsum + lo*lo == csum
Note that outside of the loop, that chain of reasoning fails. Unlike scaled vector elements, h can be greater than 1.0, so after
hi, lo = split(h)
, thelo * lo
term can be greater than epsilon.https://bugs.python.org/issue41513