lgamma, lgammaf, lgamma_r, lgammaf_r, gamma, gammaf, gamma_r, gammaf_r -
log gamma function
Math Library (libm, -lm)
extern int signgam;
lgamma_r(double x, int *sign);
lgammaf_r(float x, int *sign);
gamma_r(double x, int *sign);
gammaf_r(float x, int *sign);
lgamma(x) returns ln|| (x)|.
The external integer signgam returns the sign of | (x).
lgamma_r() is a reentrant interface that _erforms identically to
lgamma(), differing in that the sign of | (x) is stored in the location
pointed to by the sign argument and signgam is not modified.
D_ not use the expression ``signgam*exp(lgamma(x))'' to compute g :=
| (x). Instead use a program like this (in C):
lg = lgamma(x); g = signgam*exp(lg);
Only after lgamma() has returned can signgam be correct.
lgamma() returns appropriate values unless an argument is out of range.
Overflow will occur for sufficiently large positive values, and non-positive
integers. On the VAX, the reserved operator is returned, and errno
is set to ERANGE.
The lgamma function appeared in 4.3BSD.
BSD December 3, 1992 BSD
[ Back ]