1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
7 .\" based on glibc infopages
9 .TH lgamma 3 (date) "Linux man-pages (unreleased)"
11 lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r, signgam \-
15 .RI ( libm ", " \-lm )
20 .BI "double lgamma(double " x );
21 .BI "float lgammaf(float " x );
22 .BI "long double lgammal(long double " x );
24 .BI "double lgamma_r(double " x ", int *" signp );
25 .BI "float lgammaf_r(float " x ", int *" signp );
26 .BI "long double lgammal_r(long double " x ", int *" signp );
28 .BI "extern int " signgam ;
32 Feature Test Macro Requirements for glibc (see
33 .BR feature_test_macros (7)):
38 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE
39 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
40 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
46 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
47 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
48 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
55 /* Since glibc 2.19: */ _DEFAULT_SOURCE
56 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
62 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
63 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
66 For the definition of the Gamma function, see
74 functions return the natural logarithm of
75 the absolute value of the Gamma function.
76 The sign of the Gamma function is returned in the
81 It is 1 when the Gamma function is positive or zero, \-1
84 Since using a constant location
86 is not thread-safe, the functions
91 have been introduced; they return the sign via the argument
94 On success, these functions return the natural logarithm of Gamma(x).
98 is a NaN, a NaN is returned.
102 is 1 or 2, +0 is returned.
106 is positive infinity or negative infinity,
107 positive infinity is returned.
111 is a nonpositive integer,
113 and the functions return
120 If the result overflows,
121 a range error occurs,
122 .\" e.g., lgamma(DBL_MAX)
123 and the functions return
128 respectively, with the correct mathematical sign.
132 for information on how to determine whether an error has occurred
133 when calling these functions.
135 The following errors can occur:
137 Pole error: \fIx\fP is a nonpositive integer
142 A divide-by-zero floating-point exception
146 Range error: result overflow
150 An overflow floating-point exception
153 .\" glibc (as at 2.8) also supports an inexact
154 .\" exception for various cases.
192 In glibc 2.9 and earlier,
193 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6777
194 when a pole error occurs,
198 instead of the POSIX-mandated
200 Since glibc 2.10, glibc does the right thing.