Pré. | Proc. |
fac
Factorial function.SYNOPSIS:
double y, fac();
int i;
y = fac(i);
DESCRIPTION:
Returns factorial of i = 1 * 2 * 3 * ... * i.
fac(0) = 1.0.
Due to machine arithmetic bounds the largest value of i accepted is 33 in DEC arithmetic or 170 in IEEE arithmetic. Greater values, or negative ones, produce an error message and return MAXNUM.
ACCURACY:
For i < 34 the values are simply tabulated, and have full machine accuracy. If i > 55, fac(i) = gamma(i+1);
Relative error:
arithmetic domain peak
IEEE 0, 170 1.4e-15
DEC 0, 33 1.4e-17