

 
Manual Reference Pages  GAMMA (3)
NAME
lgamma,
lgamma_r,
lgammaf,
lgammaf_r,
lgammal,
lgammal_r,
gamma,
gamma_r,
gammaf,
gammaf_r,
tgamma,
tgammaf
 log gamma functions, gamma function
CONTENTS
Library
Synopsis
Description
Idiosyncrasies
Return Values
See Also
Standards
History
LIBRARY
.Lb libm
SYNOPSIS
.In math.h
extern int
signgam;
double
lgamma double x
double
lgamma_r double x int *signgamp
float
lgammaf float x
float
lgammaf_r float x int *signgamp
long double
lgammal long double x
long double
lgammal_r long double x int *signgamp
double
gamma double x
double
gamma_r double x int *signgamp
float
gammaf float x
float
gammaf_r float x int *signgamp
long double
tgamma double x
float
tgammaf float x
DESCRIPTION
lgamma x,
lgammaf x,
and
lgammal x
return ln^{_}(x) where
^{_}(x) = I_{}_{0}_{0}^{}^{oo}^{0} t^{}^{x1}^{0} e^{}^{t}^{0} dt for x > 0 and
^{_}(x) = pi/(^{_}(1x)sin(pix)) for x < 1.
return ln^{_}(x).
The external integer
signgam
returns the sign of ^{_}(x).
lgamma_r x signgamp,
lgammaf_r x signgamp,
and
lgammal_r x signgamp
provide the same functionality as
lgamma x,
lgammaf x,
and
lgammal x,
but the caller must provide an integer to store the sign of ^{_}(x).
The
tgamma x
and
tgammaf x
functions return ^{_}(x), with no effect on
signgam.
gamma,
gammaf,
gamma_r,
and
gammaf_r
are deprecated aliases for
lgamma,
lgammaf,
lgamma_r,
and
lgammaf_r,
respectively.
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
or
lgammaf
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.
Exponentiation of
lgamma
will lose up to 10 significant bits.
RETURN VALUES
gamma,
gammaf,
gammal,
gamma_r,
gammaf_r,
gammal_r,
lgamma,
lgammaf,
lgammal,
lgamma_r,
lgammaf_r,
and
lgammal_r
return appropriate values unless an argument is out of range.
Overflow will occur for sufficiently large positive values, and
nonpositive integers.
For large noninteger negative values,
tgamma
will underflow.
SEE ALSO
math(3)
STANDARDS
The
lgamma,
lgammaf,
lgammal,
tgamma,
and
tgammaf
functions are expected to conform to
isoC99.
HISTORY
The
lgamma
function appeared in
BSD 4.3 .
The
gamma
function appeared in
BSD 4.4
as a function which computed ^{_}(x).
This version was used in
.Fx 1.1 .
The name
gamma
was originally dedicated to the
lgamma
function,
and that usage was restored by switching to Sun’s fdlibm in
.Fx 1.1.5 .
The
tgamma
function appeared in
.Fx 5.0 .
Visit the GSP FreeBSD Man Page Interface. Output converted with manServer 1.07. 