Skip to content

Take a Catalan number through one quotient of factorials - #2349

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-catalan-number-past-the-exponent-range
Nov 3, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-catalan-number-past-the-exponent-range

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Two defects in numerical factorial quotients. Sweep 7's compilesweep found the first on catalannumber(Ei(sinh(x))) at 6, and probing it turned up the second. No issues were filed.

master now mpmath
catalannumber(449.5) NaN 2.4958e266 2.4958e266
catalannumber(500.5) NaN 1.0774e297 1.0774e297
catalannumber(-60.3) NaN -8.3875e-40 -8.3875e-40
catalannumber(2000.5) NaN +oo 1.66e1199, past the range
fallingfactorial(0.5, -100.5) 0 9.4020e-161 9.4020e-161
risingfactorial(100.5, -60.5) 0 2.1884e-111 2.1884e-111

Agreement with mpmath is to 1e-99 relative everywhere, except catalannumber(1600.25) at 1.2e-96. There, 4^n multiplies the error of ln 4 by n ln 4 ≈ 2200, as it did on the old path.

Tests: ACatalanNumberPastTheExponentRangeTest, 9 cases against mpmath at 120 digits. 8 fail on master; the control, catalannumber(10.5), passes on both. The full suite, AOT and the nine harnesses pass. None of catalannumber, fallingfactorial or risingfactorial is in 2.6.0, so there is no breaking entry.

🤖 Generated with Claude Code

A Catalan number of a number that is not whole is 4^n Γ(n + 1/2) over
√π Γ(n + 2), and each gamma was computed in the evaluation's exponent
range. From n = 449.5, whose number is 2.5e266, both were +oo and the
quotient NaN, and catalannumber(-60.3), -8.4e-40, was NaN as well. The two
gammas are now one QuotientOfFactorials, as the binomial's are since
#2338, and for a real n the 4^n times it is formed in decimals with no
bound on the exponent and rounded at the end: a number made of 4^(1e20)
itself has an exponent near 6e19, which the downcasting cannot read as an
integer. Found by compilesweep, on catalannumber(Ei(sinh(x))) at 6.

And QuotientOfFactorials made its result as any number, which reads a
value under the downcasting tolerance as a cancellation's residual and
rounds it onto zero. A quotient cancels nothing: fallingfactorial(0.5,
-100.5), 9.4e-161, was 0, and risingfactorial(100.5, -60.5), 2.2e-111,
was 0. The quotient, and the falling factorial over k! beside it, are now
made at a zero scale.

None of the three functions is in 2.6.0, so there is no breaking entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Nov 3, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Nov 3, 2026
@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.79%. Comparing base (0e96927) to head (0cb38fb).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2349   +/-   ##
=======================================
  Coverage   86.79%   86.79%           
=======================================
  Files         312      312           
  Lines       68664    68675   +11     
  Branches    19987    19988    +1     
=======================================
+ Hits        59595    59605   +10     
- Misses       4902     4903    +1     
  Partials     4167     4167           
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.33% <100.00%> (+<0.01%) ⬆️
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.69% <100.00%> (+0.14%) ⬆️

... and 2 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 0731fc1 into master Nov 3, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Nov 3, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-catalan-number-past-the-exponent-range branch November 3, 2026 13:12
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.

1 participant