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 2017-09-15 "GNU" "Linux Programmer's Manual"
15 tgamma, tgammaf, tgammal \- true gamma function
19 .BI "double tgamma(double " x );
21 .BI "float tgammaf(float " x );
23 .BI "long double tgammal(long double " x );
28 Feature Test Macro Requirements for glibc (see
29 .BR feature_test_macros (7)):
38 _POSIX_C_SOURCE\ >=\ 200112L
42 These functions calculate the Gamma function of
45 The Gamma function is defined by
48 Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
51 It is defined for every real number except for nonpositive integers.
52 For nonnegative integral
60 and, more generally, for all
64 Gamma(x+1) = x * Gamma(x)
67 Furthermore, the following is valid for all values of
72 Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
75 On success, these functions return Gamma(x).
79 is a NaN, a NaN is returned.
83 is positive infinity, positive infinity is returned.
87 is a negative integer, or is negative infinity,
88 a domain error occurs,
89 and a NaN is returned.
91 If the result overflows,
93 and the functions return
98 respectively, with the correct mathematical sign.
100 If the result underflows,
101 a range error occurs,
102 and the functions return 0, with the correct mathematical sign.
108 and the functions return
113 respectively, with the same sign as the 0.
117 for information on how to determine whether an error has occurred
118 when calling these functions.
120 The following errors can occur:
122 Domain error: \fIx\fP is a negative integer, or negative infinity
126 An invalid floating-point exception
128 is raised (but see BUGS).
130 Pole error: \fIx\fP is +0 or \-0
134 A divide-by-zero floating-point exception
138 Range error: result overflow
142 An overflow floating-point exception
146 glibc also gives the following error which is not specified
147 in C99 or POSIX.1-2001.
149 Range error: result underflow
150 .\" e.g., tgamma(-172.5) on glibc 2.8/x86-32
154 An underflow floating-point exception
160 .\" glibc (as at 2.8) also supports an inexact
161 .\" exception for various cases.
163 These functions first appeared in glibc in version 2.1.
165 For an explanation of the terms used in this section, see
171 Interface Attribute Value
176 T} Thread safety MT-Safe
179 C99, POSIX.1-2001, POSIX.1-2008.
181 This function had to be called "true gamma function"
182 since there is already a function
184 that returns something else (see
188 Before version 2.18, the glibc implementation of these functions did not set
189 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
195 is negative infinity.
198 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6810
199 the glibc implementation of these functions did not set
203 on an underflow range error.
207 In glibc versions 2.3.3 and earlier,
208 an argument of +0 or \-0 incorrectly produced a domain error
214 exception raised), rather than a pole error.