gamma(3M) gamma(3M)
NAME
gamma - log gamma function
SYNOPSIS
#include <math.h>
extern int signgam;
double gamma (x)
double x;
DESCRIPTION
gamma returns the natural log of gamma as a function of the
absolute value of a given value. gamma returns ln(|(x)|),
where (x) is defined as
oo
e-ttx-1dt.
0
The sign of (x) is returned in the external 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 LNMAXDOUBLE 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 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).
SEE ALSO
exp(3M), matherr(3M), values(5).
Page 1 (last mod. 1/14/87)