1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" Based on glibc infopages
4 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
5 .\" <mtk.manpages@gmail.com>
6 .\" Modified 2004-11-15, fixed error noted by Fabian Kreutz
7 .\" <kreutz@dbs.uni-hannover.de>
8 .TH TGAMMA 3 2010-09-20 "GNU" "Linux Programmer's Manual"
10 tgamma, tgammaf, tgammal \- true gamma function
14 .BI "double tgamma(double " x );
16 .BI "float tgammaf(float " x );
18 .BI "long double tgammal(long double " x );
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
32 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
33 _POSIX_C_SOURCE\ >=\ 200112L;
40 The Gamma function is defined by
42 Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
44 It is defined for every real number except for nonpositive integers.
45 For nonnegative integral \fIm\fP one has
49 and, more generally, for all \fIx\fP:
51 Gamma(x+1) = x * Gamma(x)
53 Furthermore, the following is valid for all values of \fIx\fP
56 Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
59 On success, these functions return Gamma(x).
63 is a NaN, a NaN is returned.
67 is positive infinity, positive infinity is returned.
71 is a negative integer, or is negative infinity,
72 a domain error occurs,
73 and a NaN is returned.
75 If the result overflows,
77 and the functions return
82 respectively, with the correct mathematical sign.
84 If the result underflows,
86 and the functions return 0, with the correct mathematical sign.
92 and the functions return
97 respectively, with the same sign as the 0.
101 for information on how to determine whether an error has occurred
102 when calling these functions.
104 The following errors can occur:
106 Domain error: \fIx\fP is a negative integer, or negative infinity
107 .\" FIXME . errno is not set to EDOM for x == -inf
108 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
112 An invalid floating-point exception
114 is raised (but see BUGS).
116 Pole error: \fIx\fP is +0 or \-0
120 A divide-by-zero floating-point exception
124 Range error: result overflow
128 An overflow floating-point exception
132 glibc also gives the following error which is not specified
133 in C99 or POSIX.1-2001.
135 Range error: result underflow
136 .\" e.g., tgamma(-172.5) on glibc 2.8/x86-32
140 An underflow floating-point exception
145 is not set for this case.
146 .\" FIXME . Is it intentional that errno is not set:
147 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6810
149 .\" glibc (as at 2.8) also supports and an inexact
150 .\" exception for various cases.
152 These functions first appeared in glibc in version 2.1.
156 This function had to be called "true gamma function"
157 since there is already a function
159 that returns something else (see
165 is negative infinity,
167 is not set (it should be set to
169 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
171 In glibc versions 2.3.3 and earlier,
172 an argument of +0 or \-0 incorrectly produced a domain error
178 exception raised), rather than a pole error.