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 2008-08-11 "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)):
31 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
35 The Gamma function is defined by
37 Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
39 It is defined for every real number except for nonpositive integers.
40 For nonnegative integral \fIm\fP one has
44 and, more generally, for all \fIx\fP:
46 Gamma(x+1) = x * Gamma(x)
48 Furthermore, the following is valid for all values of \fIx\fP
51 Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
54 On success, these functions return Gamma(x).
58 is a NaN, a NaN is returned.
62 is positive infinity, positive infinity is returned.
66 is a negative integer, or is negative infinity,
67 a domain error occurs,
68 and a NaN is returned.
70 If the result overflows,
72 and the functions return
77 respectively, with the correct mathematical sign.
79 If the result underflows,
81 and the functions return 0, with the correct mathematical sign.
87 and the functions return
92 respectively, with the same sign as the 0.
96 for information on how to determine whether an error has occurred
97 when calling these functions.
99 The following errors can occur:
101 Domain error: \fIx\fP is a negative integer, or negative infinity
102 .\" FIXME . errno is not set to EDOM for x == -inf
103 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
107 An invalid floating-point exception
109 is raised (but see BUGS).
111 Pole error: \fIx\fP is +0 or \-0
115 A divide-by-zero floating-point exception
119 Range error: result overflow
123 An overflow floating-point exception
127 glibc also gives the following error which is not specified
128 in C99 or POSIX.1-2001.
130 Range error: result underflow
131 .\" e.g., tgamma(-172.5) on glibc 2.8/x86-32
135 An underflow floating-point exception
140 is not set for this case.
141 .\" FIXME . Is it intentional that errno is not set:
142 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6810
144 .\" glibc (as at 2.8) also supports and an inexact
145 .\" exception for various cases.
147 These functions first appeared in glibc in version 2.1.
151 This function had to be called "true gamma function"
152 since there is already a function
154 that returns something else (see
160 is negative infinity,
162 is not set (it should be set to
164 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
166 In glibc versions 2.3.3 and earlier,
167 an argument of +0 or -0 incorrectly produced a domain error
173 exception raised), rather than a pole error.