lz_factorial
The product of the whole numbers from one to the operand, n!.
long lz_factorial( CLZNumber* leftOperand, CLZNumber* targetNumber = nullptr );
Exact, for a whole number at or above nought; 0! is one. A fraction or a negative number is refused, kFailed, flagged not-a-number; lz_gamma takes any number. A factorial past the answer limit is refused before any work is done, kTooLarge.
Examples
| Call | Answer | Returns |
|---|---|---|
lz_factorial( 20 ) | 2432902008176640000 | kNoError |
lz_factorial( 0 ) | 1 | kNoError |
lz_factorial( 50 ) | 30414093201713378043612608166064768844377641568960512000000000000 | kNoError |
lz_factorial( 2.5 ) | not a number | kFailed |
lz_factorial( −3 ) | not a number | kFailed |
Each answer is what Addaptic printed for the call, at 36 places unless a setting is shown.
Returns
kNoError (0) when the answer is written. Otherwise an error code, with the answer flagged infinite or not-a-number; see Errors and flags.
See also
lz_gammaThe gamma function, Γ(x).lz_combinationsThe number of ways to choose the right number of things from the left, n choose k.lz_permutationsThe number of ordered arrangements of the right number of things from the left, n!/(n − k)!.