Skip to content

round is exact, and an infinity is its own nearest integer - #2285

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
round-is-exact-and-an-infinity-is-its-own-round
Oct 31, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
round-is-exact-and-an-infinity-is-its-own-round

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

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 100 digits 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 exactly from its numerator and denominator, to the even integer at a tie.

Input 2.6.0 and master Now
round(10^120 + 2/3) 10^120 10^120 + 1
round(10^120 - 2/3) 10^120 10^120 - 1
round(10^120 + 3/2) 10^120 10^120 + 2
round(+oo) throws OverflowException +oo

RoundIsExactTest: 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

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>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Oct 30, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 30, 2026
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.72%. Comparing base (b90ae8f) to head (2f83143).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.27% <100.00%> (+0.02%) ⬆️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...nuous/Evaluation.Continuous.Arithmetics.Classes.cs 87.45% <100.00%> (+0.14%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit fef0b75 into master Oct 31, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 31, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the round-is-exact-and-an-infinity-is-its-own-round branch October 31, 2026 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

round of an infinity throws, and a long rational is rounded through its decimal

1 participant