GAMMA(3M) DOMAIN/IX SYS5 GAMMA(3M)
NAME
gamma - log gamma function
USAGE
#include <math.h>
double gamma (x)
double x;
extern int signgam;
DESCRIPTION
Gamma returns ln(|Γ(x)|), where Γ(x) is defined as
oo -t x-1
∫ e t dt. The sign of Γ(x) is returned in the external
0
integer signgam. The argument x may not be a non-positive
integer.
The following C program fragment might be used to calculate
Γ:
if ((y = gamma(x)) > LN_MAXDOUBLE)
error();
y = signgam * exp(y);
where LN_MAXDOUBLE is the least value that causes exp(3M) to
return a range error, and is defined in the <values.h>
header file.
DIAGNOSTICS
For non-negative integer arguments, gamma returns HUGE, sets
errno to EDOM, and prints a SING error message on the stan-
dard error output.
If the correct value would overflow, gamma returns HUGE and
sets errno to ERANGE.
These error-handling procedures may be changed with the
function matherr(3M).
NOTE
User programs that call this routine but do not link with
libm.a will, instead, reference an older routine included in
/lib/clib. Support for the old (in clib) routines will be
discontinued in a future release. See intro(3M).
RELATED INFORMATION
exp(3M), matherr(3M), values(5)
Printed 12/4/86 GAMMA-1