Click or drag to resize

SpecialFunctionsFactorial(Int32) Method

Computes the factorial function x -> x! of an integer number >= 0. The function can represent all numbers up to 22! exactly, and all numbers up to 170! using a double representation. Larger values will overflow to infinity.

Namespace: Altaxo.Calc
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3572.0 (4.8.3572.0)
Syntax
C#
public static double Factorial(
	int x
)

Parameters

x  Int32
The integer value to compute the factorial for (must be >= 0).

Return Value

Double
x! as a double (or Double.PositiveInfinity for overflow).
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionThrown when x is negative.
Remarks
If you need to multiply or divide various such factorials, consider using the logarithmic version FactorialLn(Int32) instead so you can add instead of multiply and subtract instead of divide, and then exponentiate the result using Exp(Double). This will also circumvent the problem that factorials become very large even for small parameters.
See Also