GAMMA(3M) — Silicon Graphics
NAME
gamma − log gamma function
SYNOPSIS
#include <math.h>
extern int signgam;
long float gamma (x)
long float x;
DESCRIPTION
Gamma returns ln(|Γ( x)|), whereΓ( x) is defined as ∞∫0e−ttx−1dt. 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)) > LOGHUGE)
error();
y = signgam ∗ exp(y);
where LOGHUGE is the least value that causes exp(3M) to return a range error.
DIAGNOSTICS
Gamma checks its input for the illegal values Nan and ∞, raising a floating point exception with the type codes INVALID_OP_A, and INVALID_OP_F2, respecively. Non-positive integer arguments cause a floating point exception to be raised with the type code DOMAIN_ERROR.
A floating point exception with the type OVERFL is raised if the input value would cause gamma to overflow.
In all cases, the operation is MATH, and the global function identifier _mathfunc_id is set to GAMMA.
SEE ALSO
Version 2.5r1 — October 29, 1986