Repository navigation
The combinatorial functions compile - #2213
Merged
Merged
Conversation
binomial, fallingfactorial, risingfactorial and n!! were refused by both compilers. Each compiles now, in double precision and on the interpreter's terms, in CombinatorialFunctions: a whole order is a product, and the reciprocal of one for a negative order, and any other goes through the gamma function, with NaN at a pole of the numerator and 0 at one of the denominator. The double factorial has no value off the whole numbers or at a negative even one. FastExpression has an instruction for each, and the LINQ compiler a Complex and a double definition. Both are checked against evaluation over every pair of fourteen whole, half-whole and complex arguments. Part of #2195 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2213 +/- ##
==========================================
+ Coverage 86.57% 86.60% +0.02%
==========================================
Files 302 303 +1
Lines 67059 67168 +109
Branches 19472 19495 +23
==========================================
+ Hits 58055 58168 +113
+ Misses 4899 4895 -4
Partials 4105 4105
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This was referenced Oct 30, 2026
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.
Part of #2195, item 3: the binomial coefficient, the falling and the rising factorial and the double factorial compile, in FastExpression and in the LINQ compiler.
Each was refused by both. They compile now in double precision, in
Numerics/CombinatorialFunctions, on the interpreter's terms:NaNwhere a factor of it vanishes.NaNat a pole of the numerator and0at one of the denominator, as Evaluate a binomial with a whole upper argument and a fractional lower one #2211 and A binomial at a pole of its denominator is zero #2212 made evaluation do.FastExpression has an instruction for each. The LINQ compiler has a
Complexand adoubledefinition in the generatedMathAllMethods, widened todoublefirst as the special functions are.binomial(x, 2),Compile("x").Call(5)UncompilableNodeException10binomial(x, 1/2),Compile<double, double>at3UncompilableNodeException2.037183271576257fallingfactorial,risingfactorialandn!!are new since 2.6.0, and compile from the start.Tests:
CombinatorialCompilationTestcompiles each of the three two-argument functions three ways: FastExpression, LINQ overComplex, and LINQ overdoublefor real values. Each is compared with evaluation at every pair of 14 arguments: whole ones from-3to5, halves,9/4,1 + iandi/2. A pair evaluation leaves unevaluated is counted rather than claimed, and at least three quarters of the pairs are compared.n!!is compared the same way.UserInvalidExceptionspinnedbinomial(x, 2)as having no compiled form, and pinspolygamma(1, x)instead. Full suite 17933/0 after that change, interactive trio, AOT smoke 68/0, all frameworks build.Still open on #2195:
gamma(a, z),polygammaand the newer special functions, the integer functions, and item 4.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura