1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" Distributed under GPL
7 .\" Based on glibc infopages
8 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
9 .\" <mtk.manpages@gmail.com>
10 .\" Modified 2004-11-15, fixed error noted by Fabian Kreutz
11 .\" <kreutz@dbs.uni-hannover.de>
13 .TH TGAMMA 3 2021-03-22 "GNU" "Linux Programmer's Manual"
15 tgamma, tgammaf, tgammal \- true gamma function
20 .BI "double tgamma(double " x );
21 .BI "float tgammaf(float " x );
22 .BI "long double tgammal(long double " x );
28 Feature Test Macro Requirements for glibc (see
29 .BR feature_test_macros (7)):
36 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
39 These functions calculate the Gamma function of
42 The Gamma function is defined by
45 Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
48 It is defined for every real number except for nonpositive integers.
49 For nonnegative integral
57 and, more generally, for all
61 Gamma(x+1) = x * Gamma(x)
64 Furthermore, the following is valid for all values of
69 Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
72 On success, these functions return Gamma(x).
76 is a NaN, a NaN is returned.
80 is positive infinity, positive infinity is returned.
84 is a negative integer, or is negative infinity,
85 a domain error occurs,
86 and a NaN is returned.
88 If the result overflows,
90 and the functions return
95 respectively, with the correct mathematical sign.
97 If the result underflows,
99 and the functions return 0, with the correct mathematical sign.
105 and the functions return
110 respectively, with the same sign as the 0.
114 for information on how to determine whether an error has occurred
115 when calling these functions.
117 The following errors can occur:
119 Domain error: \fIx\fP is a negative integer, or negative infinity
123 An invalid floating-point exception
125 is raised (but see BUGS).
127 Pole error: \fIx\fP is +0 or \-0
131 A divide-by-zero floating-point exception
135 Range error: result overflow
139 An overflow floating-point exception
143 glibc also gives the following error which is not specified
144 in C99 or POSIX.1-2001.
146 Range error: result underflow
147 .\" e.g., tgamma(-172.5) on glibc 2.8/x86-32
151 An underflow floating-point exception
157 .\" glibc (as at 2.8) also supports an inexact
158 .\" exception for various cases.
160 These functions first appeared in glibc in version 2.1.
162 For an explanation of the terms used in this section, see
170 Interface Attribute Value
175 T} Thread safety MT-Safe
181 C99, POSIX.1-2001, POSIX.1-2008.
183 This function had to be called "true gamma function"
184 since there is already a function
186 that returns something else (see
190 Before version 2.18, the glibc implementation of these functions did not set
191 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
197 is negative infinity.
200 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6810
201 the glibc implementation of these functions did not set
205 on an underflow range error.
208 In glibc versions 2.3.3 and earlier,
209 an argument of +0 or \-0 incorrectly produced a domain error
215 exception raised), rather than a pole error.