1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
3 .\" Distributed under GPL
5 .\" Based on glibc infopages
6 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
7 .\" <mtk.manpages@gmail.com>
8 .\" Modified 2004-11-15, fixed error noted by Fabian Kreutz
9 .\" <kreutz@dbs.uni-hannover.de>
10 .TH TGAMMA 3 2010-09-20 "GNU" "Linux Programmer's Manual"
12 tgamma, tgammaf, tgammal \- true gamma function
16 .BI "double tgamma(double " x );
18 .BI "float tgammaf(float " x );
20 .BI "long double tgammal(long double " x );
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
34 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
35 _POSIX_C_SOURCE\ >=\ 200112L;
42 The Gamma function is defined by
44 Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
46 It is defined for every real number except for nonpositive integers.
47 For nonnegative integral \fIm\fP one has
51 and, more generally, for all \fIx\fP:
53 Gamma(x+1) = x * Gamma(x)
55 Furthermore, the following is valid for all values of \fIx\fP
58 Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
61 On success, these functions return Gamma(x).
65 is a NaN, a NaN is returned.
69 is positive infinity, positive infinity is returned.
73 is a negative integer, or is negative infinity,
74 a domain error occurs,
75 and a NaN is returned.
77 If the result overflows,
79 and the functions return
84 respectively, with the correct mathematical sign.
86 If the result underflows,
88 and the functions return 0, with the correct mathematical sign.
94 and the functions return
99 respectively, with the same sign as the 0.
103 for information on how to determine whether an error has occurred
104 when calling these functions.
106 The following errors can occur:
108 Domain error: \fIx\fP is a negative integer, or negative infinity
109 .\" FIXME . errno is not set to EDOM for x == -inf
110 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
114 An invalid floating-point exception
116 is raised (but see BUGS).
118 Pole error: \fIx\fP is +0 or \-0
122 A divide-by-zero floating-point exception
126 Range error: result overflow
130 An overflow floating-point exception
134 glibc also gives the following error which is not specified
135 in C99 or POSIX.1-2001.
137 Range error: result underflow
138 .\" e.g., tgamma(-172.5) on glibc 2.8/x86-32
142 An underflow floating-point exception
147 is not set for this case.
148 .\" FIXME . Is it intentional that errno is not set:
149 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6810
151 .\" glibc (as at 2.8) also supports and an inexact
152 .\" exception for various cases.
154 These functions first appeared in glibc in version 2.1.
158 This function had to be called "true gamma function"
159 since there is already a function
161 that returns something else (see
167 is negative infinity,
169 is not set (it should be set to
171 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
173 In glibc versions 2.3.3 and earlier,
174 an argument of +0 or \-0 incorrectly produced a domain error
180 exception raised), rather than a pole error.