gamma(3m) DG/UX 4.30 gamma(3m)
NAME
gamma - log gamma function
SYNOPSIS
#include <math.h>
double gamma (x)
double x;
extern int signgam;
DESCRIPTION
In this discussion, Γ~ represents the Greek letter gamma.
Gamma returns ln(|Γ~(x)|), where Γ~(x) is defined as
oo
∫ e-ttx-1dt. The sign of Γ~(x) is returned in the external
0
integer signgam. The argument x must be a non-negative
integer.
The following C program fragment might be used to calculate
Γ~:
if ((y = gamma(x)) > LN_MAXDOUBLE)
error();
y = signgam * exp(y);
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 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.
You can change these error-handling procedures with the
function matherr(3M).
SEE ALSO
exp(3M), matherr(3M), values(5).
Licensed material--property of copyright holder(s) Page 1