1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
.\" 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 non-positive 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, SVr4, 4.3BSD
.SH "SEE ALSO"
.BR tgamma (3)
|