Repository navigation
round is exact, and an infinity is its own nearest integer - #2285
Merged
Rafael-SOWNet merged 1 commit intoOct 31, 2026
Merged
Conversation
round(10^120 + 2/3) was 10^120, where it is 10^120 + 1, and round(+oo) threw OverflowException. Roundf took a rational through its decimal, which at the precision had already rounded 10^120 + 2/3 onto 10^120, and handed an infinity to EInteger, which refuses one. floor and ceil had both defects and were fixed in #830 and #1807; round now does as they do: an infinity and NaN pass through, and a rational is rounded from its numerator and denominator, to the even integer at a tie. RoundIsExactTest takes thirteen roundings; six fail on master, the four long rationals that do not round onto the integer beside them and both infinities. The suite, the trio, F#, AOT and the eight harnesses pass. Fixes #2282. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2285 +/- ##
==========================================
+ Coverage 86.70% 86.72% +0.02%
==========================================
Files 310 310
Lines 67846 67859 +13
Branches 19689 19691 +2
==========================================
+ Hits 58824 58850 +26
+ Misses 4902 4890 -12
+ Partials 4120 4119 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Rafael-SOWNet
deleted the
round-is-exact-and-an-infinity-is-its-own-round
branch
October 31, 2026 03:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
round(10^120 + 2/3)was10^120, where it is10^120 + 1, andround(+oo)threwOverflowException.Roundftook a rational through its decimal, which at 100 digits had already rounded10^120 + 2/3onto10^120, and handed an infinity toEInteger, which refuses one.floorandceilhad both defects and were fixed in #830 and #1807.roundnow does as they do: an infinity and NaN pass through, and a rational is rounded exactly from its numerator and denominator, to the even integer at a tie.round(10^120 + 2/3)10^12010^120 + 1round(10^120 - 2/3)10^12010^120 - 1round(10^120 + 3/2)10^12010^120 + 2round(+oo)OverflowException+ooRoundIsExactTest: 6 of its 13 cases fail on master. The suite (18,278), the trio, F#, AOT and the eight harnesses pass locally.With #2284,
limit(round(x) / x, x, +oo)is left unevaluated rather than throwing.Fixes #2282.
🤖 Generated with Claude Code