]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/lgamma.3
Added/updated glibc feature test macro requirements
[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 2007-07-26 "" "Linux Programmer's Manual"
6 .SH NAME
7 lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r, signgam \-
8 log gamma function
9 .SH SYNOPSIS
10 .nf
11 .B #include <math.h>
12 .sp
13 .BI "double lgamma(double " x );
14 .br
15 .BI "float lgammaf(float " x );
16 .br
17 .BI "long double lgammal(long double " x );
18 .sp
19 .BI "double lgamma_r(double " x ", int *" signp );
20 .br
21 .BI "float lgammaf_r(float " x ", int *" signp );
22 .br
23 .BI "long double lgammal_r(long double " x ", int *" signp );
24 .br
25 .BI "extern int " signgam ;
26 .fi
27 .sp
28 Link with \fI\-lm\fP.
29 .sp
30 .in -4n
31 Feature Test Macro Requirements for glibc (see
32 .BR feature_test_macros (7)):
33 .in
34 .sp
35 .ad l
36 .BR lgamma (),
37 .BR lgammaf (),
38 .BR lgammal ():
39 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE; or
40 .I cc\ -std=c99
41 .br
42 .BR lgamma_r (),
43 .BR lgammaf_r (),
44 .BR lgammal_r ():
45 _BSD_SOURCE || _SVID_SOURCE
46 .br
47 .IR signgam :
48 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE
49 .ad b
50 .SH DESCRIPTION
51 For the definition of the Gamma function, see
52 .BR tgamma (3).
53 .PP
54 The
55 .BR lgamma ()
56 function returns the natural logarithm of
57 the absolute value of the Gamma function.
58 The sign of the Gamma function is returned in the
59 external integer \fIsigngam\fP declared in
60 .IR <math.h> .
61 It is 1 when the Gamma function is positive or zero, \-1
62 when it is negative.
63 .PP
64 Since using a constant location
65 .I signgam
66 is not thread-safe, the functions
67 .BR lgamma_r ()
68 etc. have
69 been introduced; they return this sign via the parameter
70 .IR signp .
71 .PP
72 For non-positive integer values of \fIx\fP,
73 .BR lgamma ()
74 returns
75 .BR HUGE_VAL ,
76 sets \fIerrno\fP to
77 .B ERANGE
78 and raises the zero divide exception.
79 (Similarly,
80 .BR lgammaf ()
81 returns
82 .B HUGE_VALF
83 and
84 .BR lgammal ()
85 returns
86 .BR HUGE_VALL .)
87 .SH ERRORS
88 In order to check for errors, set
89 .I errno
90 to zero and call
91 .I feclearexcept(FE_ALL_EXCEPT)
92 before calling these functions.
93 On return, if
94 .I errno
95 is non-zero or
96 .I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
97 is non-zero, an error has occurred.
98 .LP
99 A range error occurs if x is too large.
100 A pole error occurs if x is a negative integer or zero.
101 .SH "CONFORMING TO"
102 C99, SVr4, 4.3BSD
103 .SH "SEE ALSO"
104 .BR tgamma (3)