GAMMA(3M) SysV GAMMA(3M)
NAME
gamma - log gamma function
SYNOPSIS
#include <math.h>
double gamma (x)
double x;
extern int signgam;
DESCRIPTION
oo -t x-1
gamma returns ln(|G(x)|), where G(x) is defined as ^ e t dt. The sign
of G(x) is returned in the external integer signgam.
0 The argument x may
not be a non-positive integer.
The following C program fragment might be used to calculate G:
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.
SEE ALSO
exp(3M), matherr(3M), values(5).
DIAGNOSTICS
For non-negative integer arguments HUGE is returned, and errno is set to
EDOM. A message indicating SING error is printed on the standard 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).