LGAMMA(3) OpenBSD Programmer's Manual LGAMMA(3)NAME
lgamma, lgammaf, tgamma, tgammaf - log gamma functions
SYNOPSIS
#include <math.h>
extern int signgam;
double
lgamma(double x);
float
lgammaf(float x);
double
tgamma(double x);
float
tgammaf(float x);
DESCRIPTIONlgamma(x) returns ln||(x)|.
The external integer signgam returns the sign of |(x). The lgammaf()
function is a single precision version of lgamma().
The tgamma(x) and tgammaf(x) functions return |(x), with no effect on
signgam.
IDIOSYNCRASIES
Do 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.
For arguments in its range, tgamma() is preferred, as for positive
arguments it is accurate to within one unit in the last place.
RETURN VALUESlgamma() 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 ALSOinfnan(3), math(3)STANDARDS
The lgamma(), lgammaf(), tgamma(), and tgammaf() functions are expected
to conform to ISO/IEC 9899:1999 (``ISO C99'').
gamma() and gammaf() are deprecated aliases for lgamma() and lgammaf(),
respectively.
HISTORY
The lgamma() function first appeared in 4.3BSD. The tgamma() function
first appeared in OpenBSD 4.4, and is based on the gamma() function that
appeared in 4.4BSD as a function to compute |(x).
OpenBSD 4.9 June 12, 2008 OpenBSD 4.9