-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
bpo-46018: Ensure that math.expm1 does not raise on underflow #29997
New issue
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
Just to be clear, was the bogus I'd propose a simpler fix: replace the line Line 990 in dc4a212
with if (fabs(x) < 2.0) It's arguably more dangerous in that the change potentially affects all functions using Please could you also add a testcase that would exercise the problematic case, if there isn't one already? |
It was an actual prerelease system, and it's entirely possible that the library will be fixed before it ever sees real use. But logically there's no way for expm1 to underflow to 0.0 anyway - it will always go to -1.0, because that's the spec ( I expanded the range to 1.5, as there's really no need to go any further. Quite likely making it |
Update: no need - it's already covered. (See discussion on the b.p.o. issue.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I guess it's worth running the buildbots on this one, just in case. |
🤖 New build scheduled with the buildbot fleet by @mdickinson for commit c778229 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
The SLES buildbot failed because it timed out downloading Unicode files from an external server. Definitely not related to this change. |
The buildbots seem happy so far, apart from the slow ones ... I don't think we need to wait for the rest of the buildbot results before merging - I'm happy to keep an eye on the remaining ones and raise an alert in the unlikely event that any of them fails for reasons related to this PR. |
If we're regarding this as a kinda/sorta bugfix, should it be backported to 3.10 and 3.9? |
Yes, I think it should be backported. I'll keep an eye on buildbots as well, but I expect this one to be pretty innocuous. |
Thanks @zooba for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
GH-30012 is a backport of this pull request to the 3.10 branch. |
GH-30013 is a backport of this pull request to the 3.9 branch. |
|
https://bugs.python.org/issue46018