GAMMA(S) XENIX System V GAMMA(S)
Name
gamma - Performs log gamma function.
Syntax
#include <math.h>
extern int signgam;
double gamma (x)
double x;
Description
gamma returns ln|(|x|)|. The sign of (|x|) is returned in
the external integer signgam. The following C program
fragment might be used to calculate :
if((y = gamma (x)) >LN_MAXDOUBLE)
error ();
y = exp (y) * signgam;
where LN_MAXDOUBLE is the least value that causes exp(S) to
return a range error and is defined in the <values.h> header
file.
Diagnostics
For negative integer arguments, a HUGE value 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 a HUGE
value and errno is set to ERANGE.
These error-handling procedures may be changed with the
matherr(S) function.
See Also
exp(S), matherr(S)
Notes
These routines must be linked by using the -lm linker
option.
Page 1 (printed 8/7/87)