FACT 3CW "26 December 2009" "mathcw-1.00"

Table of contents


NAME

fact - n-factorial

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

extern float factf (int n);

extern double fact (int n);

extern long double factl (int n);

extern __float80 factw (int n);

extern __float128 factq (int n);

extern long_long_double factll (int n);

extern decimal_float factdf (int n);

extern decimal_double factd (int n);

extern decimal_long_double factdl (int n);

extern decimal_long_long_double factdll (int n);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Find the value of n! (n factorial), equal to the product n * (n - 1) * (n - 2) * ... * 2 * 1, by fast table lookup with minimal additional computation, where n >= 0.

The special cases are 0! = 1! = 1.


RETURN VALUES

Return the value of n factorial. The result should be correctly rounded in at least the single- and double-precision data formats in decimal and binary. For other formats, and large n, the relative error should be less than five ulps (units in the last place).

ERRORS

If the argument is negative, set errno to EDOM and return a quiet NaN.

SEE ALSO

binom(3CW), dfact(3CW).