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 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
6 .\" Distributed under GPL
9 .\" based on glibc infopages
11 .TH LGAMMA 3 2021-03-22 "" "Linux Programmer's Manual"
13 lgamma, lgammaf, lgammal, lgamma_r, lgammaf_r, lgammal_r, signgam \-
19 .BI "double lgamma(double " x );
20 .BI "float lgammaf(float " x );
21 .BI "long double lgammal(long double " x );
23 .BI "double lgamma_r(double " x ", int *" signp );
24 .BI "float lgammaf_r(float " x ", int *" signp );
25 .BI "long double lgammal_r(long double " x ", int *" signp );
27 .BI "extern int " signgam ;
33 Feature Test Macro Requirements for glibc (see
34 .BR feature_test_macros (7)):
39 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE
40 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
41 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
47 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
48 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
49 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
56 /* Since glibc 2.19: */ _DEFAULT_SOURCE
57 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
63 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
64 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
67 For the definition of the Gamma function, see
75 functions return the natural logarithm of
76 the absolute value of the Gamma function.
77 The sign of the Gamma function is returned in the
82 It is 1 when the Gamma function is positive or zero, \-1
85 Since using a constant location
87 is not thread-safe, the functions
92 have been introduced; they return the sign via the argument
95 On success, these functions return the natural logarithm of Gamma(x).
99 is a NaN, a NaN is returned.
103 is 1 or 2, +0 is returned.
107 is positive infinity or negative infinity,
108 positive infinity is returned.
112 is a nonpositive integer,
114 and the functions return
121 If the result overflows,
122 a range error occurs,
123 .\" e.g., lgamma(DBL_MAX)
124 and the functions return
129 respectively, with the correct mathematical sign.
133 for information on how to determine whether an error has occurred
134 when calling these functions.
136 The following errors can occur:
138 Pole error: \fIx\fP is a nonpositive integer
143 A divide-by-zero floating-point exception
147 Range error: result overflow
151 An overflow floating-point exception
154 .\" glibc (as at 2.8) also supports an inexact
155 .\" exception for various cases.
159 functions are specified in C99, POSIX.1-2001, and POSIX.1-2008.
161 is specified in POSIX.1-2001 and POSIX.1-2008, but not in C99.
164 functions are nonstandard, but present on several other systems.
166 In glibc 2.9 and earlier,
167 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6777
168 when a pole error occurs,
172 instead of the POSIX-mandated
174 Since version 2.10, glibc does the right thing.