gamma(3m) — RISC
Name
gamma, lgamma, signgam − log gamma function
Syntax
#include <math.h>
double gamma(x)
double x;
double lgamma(x)
double x;
extern int signgam;
Description
The gamma function returns ln |Γ(|x|)|. The sign of Γ(|x|) is returned in the external integer signgam. The following C program might be used to calculate Γ:
y = gamma(x);
if (y > 88.0)
error();
y = exp(y);
if(signgam)
y = −y;
The lgamma function is another name for the gamma function.
Return Values
The gamma and lgamma functions return NaN when x is NaN or when it is an integer value less than or equal to zero. On overflow gamma and lgamma functions return HUGE_VAL.
Environment
When your program is compiled using the System V environment for nonpositive integer values, HUGE is returned, and errno is set to EDOM. A message indicating DOMAIN 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(.).