LGAMMA(3) BSD Programmer's Manual LGAMMA(3)
lgamma, lgammaf, lgamma_r, lgammaf_r, gamma, gammaf, gamma_r, gammaf_r - log gamma function
#include <math.h> extern int signgam; double lgamma(double x); float lgammaf(float x); double lgamma_r(double x, int *sign); float lgammaf_r(float x, int *sign); double gamma(double x); float gammaf(float x); double gamma_r(double x, int *sign); float gammaf_r(float x, int *sign);
lgamma(x) returns ln|I̅(x)|. The external integer signgam returns the sign of I̅(x). lgamma_r() is a reentrant interface that performs identically to lgam- ma(), differing in that the sign of I̅(x) is stored in the location point- ed to by the sign argument and signgam is not modified.
Do not use the expression "signgam*exp(lgamma(x))" to compute g := I̅(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. MirOS BSD #10-current December 3, 1992 1
Generated on 2014-07-04 21:17:45 by $MirOS: src/scripts/roff2htm,v 1.79 2014/02/10 00:36:11 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2014 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.