Computes the factorial of an integer.
Namespace:
Meta.Numerics.FunctionsAssembly: Meta.Numerics (in Meta.Numerics.dll) Version: 1.4.0.0 (1.4.0.0)
Syntax
| C# | Visual Basic | Visual C++ |
Parameters
- n
- Int32
The argument, which must be non-negative.
Return Value
The factorial n!.
Remarks
The factorial of an integer n is the product of all integers from 1 to n.
Because n! becomes too large to be representable as a double-precision floating point number for quite moderate values of n, you may find it convenient to use the LogFactorial(Int32) in order to avoid overflow when computing expression in which large factorials will cancel with other large factors.
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentOutOfRangeException | n is negative. |