Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-39310: Add math.ulp(x) #17965
bpo-39310: Add math.ulp(x) #17965
Conversation
This comment has been minimized.
This comment has been minimized.
The documentation should be enhanced |
This comment has been minimized.
This comment has been minimized.
Done. I copied the test_math.ulp() docstring. |
This comment has been minimized.
This comment has been minimized.
I think Java does as well as can be done here: https://www.geeksforgeeks.org/java-math-ulp-method-examples/ Short course:
|
This comment has been minimized.
This comment has been minimized.
@mdickinson, @tim-one, @serhiy-storchaka: I updated the PR. Would you mind to review it again? I rewrote the documentation to clarify the behavior on corner cases: zero, min/max, inf, NaN. |
One request for an explicit test for |
Agree with @mdickinson. The rest LGTM. |
This comment has been minimized.
This comment has been minimized.
Interesting case,
|
This comment has been minimized.
This comment has been minimized.
I'm not sure that
|
This comment has been minimized.
This comment has been minimized.
This is fine; it's just round-ties-to-even at work. |
This comment has been minimized.
This comment has been minimized.
I wrote tests differently to better highlight that we expect
|
This comment has been minimized.
This comment has been minimized.
Oh, nntplib test fail on the Documentation job of Travis CI:
I retry the job. |
This comment has been minimized.
This comment has been minimized.
Floating points are so complex :-( |
This comment has been minimized.
This comment has been minimized.
Oops, I forgot to update the documentation in the docstring and commit message: updated. |
Add math.ulp(): return the value of the least significant bit of a float.
0b2ab21
into
python:master
This comment has been minimized.
This comment has been minimized.
Thanks a lot @tim-one, @serhiy-storchaka and @mdickinson: the review was required and really helpful here ;-) |
bpo-39310: Add math.ulp(x) (pythonGH-17965)
vstinner commentedJan 12, 2020
•
edited by bedevere-bot
Add math.ulp(): return the unit in the last place of x.
https://bugs.python.org/issue39310