<-- Previous || Up || Next -->

Factorial Function
Math Probability Class

Public Function Factorial( _
    ByVal vX As Variant _
    ) As Variant

Return the factorial of the number X.
The factorial of X is the product of every number between 1 and X, except that the factorial of 1 (one) is 1.

Examples:
    IsNull(Factorial(-1)) = True
    Factorial(0) = 1
    Factorial(1) = 1
    Factorial(2) = 2
    Factorial(3) = 6
    Factorial(4) = 24
    Factorial(5) = 120
    Factorial(67) = 3.64711109181887E+94
    Factorial(170) = 7.257415615308E+306
    IsNull(Factorial(171)) = True
See also:
    Combinations Function
    CombinationsWithRepetitions Function
    Permutations Function
    FACT Function (Microsoft Excel)
vX: The number whose factorial will be returned as a Double (precision floating-point) numeric value. Function returns Null if vX is Null, cannot be interpreted as a number, or is not between 0 (zero) and 170 (the result would be greater than MaxDouble). vX is rounded down to the nearest integer.
Note: This function will not generate the factorial of a floating point number; it will ignore the fractional part of any floating point numbers by applying the Visual Basic Fix function to the number.
v1.5 Pro Note: The argument names and the implementation of this function has changed.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.