Updated: 2022/Sep/29

Please read Privacy Policy. It's for your privacy.

LGAMMA(3) Library Functions Manual LGAMMA(3)NAMElgamma,lgammaf,lgamma_r,lgammaf_r,gamma,gammaf,gamma_r,gammaf_r,tgamma,tgammaf- log gamma functionLIBRARYMath Library (libm, -lm)SYNOPSIS#include<math.h>extern int signgam; doublelgamma(double x); floatlgammaf(float x); doublelgamma_r(double x, int *sign); floatlgammaf_r(float x, int *sign); doublegamma(double x); floatgammaf(float x); doublegamma_r(double x, int *sign); floatgammaf_r(float x, int *sign); doubletgamma(double x); floattgammaf(float x);DESCRIPTIONlgamma(x) returns ln|<Gamma>(x)|. The external integer signgam returns the sign of <Gamma>(x).lgamma_r() is a reentrant interface that performs identically tolgamma(), differing in that the sign of <Gamma>(x) is stored in the location pointed to by the sign argument and signgam is not modified. Thetgamma(x) andtgammaf(x) functions return <Gamma>(x), with no effect on signgam.gamma(),gammaf(),gamma_r(), andgammaf_r() are deprecated aliases forlgamma(),lgammaf(),lgamma_r(), andlgammaf_r(), respectively.IDIOSYNCRASIESDo not use the expression "signgam*exp(lgamma(x))" to compute g := <Gamma>(x). Instead use a program like this (in C): lg = lgamma(x); g = signgam*exp(lg); Only afterlgamma() has returned can signgam be correct.RETURNVALUESlgamma() returns appropriate values unless an argument is out of range. Overflow will occur for sufficiently large positive values, and non- positive integers. For large non-integer negative values,tgamma() will underflow. On the VAX, the reserved operator is returned, and errno is set to ERANGE.SEE ALSOmath(3)HISTORYThelgammafunction appeared in 4.3BSD. Thetgamma() function appeared in NetBSD 6.0. NetBSD 10.99 May 4, 2012 NetBSD 10.99