You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a17c310
Browse filesBrowse the repository at this point in the historyBrowse files
A compiled gamma ratio past the doubles is taken in logarithms (#2251)
A compiled binomial coefficient, falling or rising factorial or Catalan
number at an argument that is not whole is a ratio of gamma functions.
Past 170! a factorial is past the doubles where the ratio need not be,
so the ratio was oo/oo, NaN: binomial(216, pi) is about 2954596.68,
fallingfactorial(300, 1/2) about 17.33, catalannumber(2017/5) about
5.16e238, and each was NaN. A ratio whose terms are under the doubles
was 0/0, as binomial(-601/2, 7/3) was, which is about 109419.24.
Where the ratio does not come out as a number, it is now the
exponential of the difference of the factorials' logarithms.
SpecialFunctions.LogFactorial is the logarithm of Gamma(z + 1), by the
Lanczos approximation the compiled gamma function already uses, and by
reflection below 1/2. At a real argument its imaginary part is a
multiple of pi, odd where the factorial is negative, which gives the
ratio's sign. None of the ratios is 0 away from a pole, which the
callers answer first, so a ratio that came out as a number is kept as
it was, to the last place.
GammaRatioCompilationTest compares ten values with mpmath 1.3.0's at 50
digits, under both compilers and over double, and all ten fail on
master. Two of them are past the doubles, binomial(2000, 1001/2) and
catalannumber(1001), and are +oo. Evaluation is NaN for three of the
ten, binomial(10, 601/2), binomial(2000, 1001/2) and
catalannumber(-2017/5), and EvalNumerical throws CannotEvalException
for catalannumber(1001). The last two of the three are past 1e200 or
under 1e-200, the decimal range #1498 is about. Those are evaluation's,
and not changed here.
Found by work/compilesweep.
Fixes#2248.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
0 commit comments