3.5.1.1.11 Fact

Description

This function is used to calculate the factorial of a non-negative integer, denoted by:

$n! = n\left (n-1 \right )\left (n-2\right )...1$

For zero, $Fact(0) = 1$.

Please note that the largest n is 170. If n is bigger than 170, this function will return missing value. To calculate factorial for the larger integer, you can use the Log_gamma function, which approximates a factorial.

Syntax

double Fact(int n)

Parameters

n

The integer number for calculating the factorial.

Return

Return the factorial of a non-negative integer n.

Example

fact(3) = ;  // 6
fact(170) = ;  // 7.257415615308E306
fact(171) = ;  // n is too big, return missing value --