]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/lgamma.3
ffix
[thirdparty/man-pages.git] / man3 / lgamma.3
1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" based on glibc infopages
4 .\"
5 .TH LGAMMA 3 2002-08-10 "" "Linux Programmer's Manual"
6 .SH NAME
7 lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r \- log gamma function
8 .SH SYNOPSIS
9 .nf
10 .B #include <math.h>
11 .sp
12 .BI "double lgamma(double " x );
13 .br
14 .BI "float lgammaf(float " x );
15 .br
16 .BI "long double lgammal(long double " x );
17 .sp
18 .BI "double lgamma_r(double " x ", int *" signp );
19 .br
20 .BI "float lgammaf_r(float " x ", int *" signp );
21 .br
22 .BI "long double lgammal_r(long double " x ", int *" signp );
23 .fi
24 .sp
25 Compile with \fI\-std=c99\fP; link with \fI\-lm\fP.
26 .SH DESCRIPTION
27 For the definition of the Gamma function, see
28 .BR tgamma (3).
29 .PP
30 The
31 .BR lgamma ()
32 function returns the natural logarithm of
33 the absolute value of the Gamma function.
34 The sign of the Gamma function is returned in the
35 external integer \fIsigngam\fP declared in
36 .IR <math.h> .
37 It is 1 when the Gamma function is positive or zero, \-1
38 when it is negative.
39 .PP
40 Since using a constant location
41 .I signgam
42 is not thread-safe, the functions
43 .BR lgamma_r ()
44 etc. have
45 been introduced; they return this sign via the parameter
46 .IR signp .
47 .PP
48 For non-positive integer values of \fIx\fP,
49 .BR lgamma ()
50 returns
51 .BR HUGE_VAL ,
52 sets \fIerrno\fP to
53 .B ERANGE
54 and raises the zero divide exception.
55 (Similarly,
56 .BR lgammaf ()
57 returns
58 .B HUGE_VALF
59 and
60 .BR lgammal ()
61 returns
62 .BR HUGE_VALL .)
63 .SH ERRORS
64 In order to check for errors, set
65 .I errno
66 to zero and call
67 .I feclearexcept(FE_ALL_EXCEPT)
68 before calling these functions.
69 On return, if
70 .I errno
71 is non-zero or
72 .I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
73 is non-zero, an error has occurred.
74 .LP
75 A range error occurs if x is too large.
76 A pole error occurs if x is a negative integer or zero.
77 .SH "CONFORMING TO"
78 C99, SVr4, 4.3BSD
79 .SH "SEE ALSO"
80 .BR tgamma (3)