man-pages/man3/lgamma.3

65 lines
1.8 KiB
Groff

.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\" based on glibc infopages
.\"
.TH LGAMMA 3 2002-08-10 "" "Linux Programmer's Manual"
.SH NAME
lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r \- log gamma function
.SH SYNOPSIS
.nf
.B #include <math.h>
.sp
.BI "double lgamma(double " x );
.br
.BI "float lgammaf(float " x );
.br
.BI "long double lgammal(long double " x );
.sp
.BI "double lgamma_r(double " x ", int *" signp );
.br
.BI "float lgammaf_r(float " x ", int *" signp );
.br
.BI "long double lgammal_r(long double " x ", int *" signp );
.fi
.sp
Compile with \-std=c99; link with \-lm.
.SH DESCRIPTION
For the definition of the Gamma function, see
.BR tgamma (3).
.PP
The \fBlgamma()\fP function returns the natural logarithm of
the absolute value of the Gamma function.
The sign of the Gamma function is returned in the
external integer \fIsigngam\fP declared in
.IR <math.h> .
It is 1 when the Gamma function is positive or zero, \-1
when it is negative.
.PP
Since using a constant location
.I signgam
is not thread-safe, the functions \fBlgamma_r()\fP etc. have
been introduced; they return this sign via the parameter
.IR signp .
.PP
For nonpositive integer values of \fIx\fP, \fBlgamma()\fP returns HUGE_VAL,
sets \fIerrno\fP to ERANGE and raises the zero divide exception.
(Similarly, \fBlgammaf()\fP returns HUGE_VALF and \fBlgammal()\fP returns
HUGE_VALL.)
.SH ERRORS
In order to check for errors, set
.I errno
to zero and call
.I feclearexcept(FE_ALL_EXCEPT)
before calling these functions. On return, if
.I errno
is non-zero or
.I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
is non-zero, an error has occurred.
.LP
A range error occurs if x is too large.
A pole error occurs if x is a negative integer or zero.
.SH "CONFORMING TO"
C99, SVID 3, BSD 4.3
.SH "SEE ALSO"
.BR tgamma (3)