FACT()
Calculates faculty
- Syntax
-
- FACT (nNumber) -> nFaculty
- Arguments
-
- <nNumber> number between 0 and 21
- Returns
-
- <nFaculty> the faculty of <nNumber>
- Description
-
- The function FACT() calculates the faculty to the integer given in <nNumber>. The faculty is defined as n! = 1*2*...*n and is often used in statistics. Note, that faculties above 21 are too big so that the function must return a -1.
Examples
? fact (0) --> 1
? fact (1) --> 1
? fact (4) --> 24
Tests
fact (0) == 1
fact (1) == 1
fact (4) == 24
- Status
- Ready
- Compliance
-
- FACT() is compatible with CT3's FACT().
- Platforms
-
- All
- Files
-
- Source is math.c, library is libct.