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 2010-09-20 "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)):
37 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
38 _POSIX_C_SOURCE\ >=\ 200112L;
45 The Gamma function is defined by
47 Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
49 It is defined for every real number except for nonpositive integers.
50 For nonnegative integral
56 and, more generally, for all
59 Gamma(x+1) = x * Gamma(x)
61 Furthermore, the following is valid for all values of
65 Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
68 On success, these functions return Gamma(x).
72 is a NaN, a NaN is returned.
76 is positive infinity, positive infinity is returned.
80 is a negative integer, or is negative infinity,
81 a domain error occurs,
82 and a NaN is returned.
84 If the result overflows,
86 and the functions return
91 respectively, with the correct mathematical sign.
93 If the result underflows,
95 and the functions return 0, with the correct mathematical sign.
101 and the functions return
106 respectively, with the same sign as the 0.
110 for information on how to determine whether an error has occurred
111 when calling these functions.
113 The following errors can occur:
115 Domain error: \fIx\fP is a negative integer, or negative infinity
116 .\" FIXME . errno is not set to EDOM for x == -inf
117 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
121 An invalid floating-point exception
123 is raised (but see BUGS).
125 Pole error: \fIx\fP is +0 or \-0
129 A divide-by-zero floating-point exception
133 Range error: result overflow
137 An overflow floating-point exception
141 glibc also gives the following error which is not specified
142 in C99 or POSIX.1-2001.
144 Range error: result underflow
145 .\" e.g., tgamma(-172.5) on glibc 2.8/x86-32
149 An underflow floating-point exception
154 is not set for this case.
155 .\" FIXME . Is it intentional that errno is not set:
156 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6810
158 .\" glibc (as at 2.8) also supports and an inexact
159 .\" exception for various cases.
161 These functions first appeared in glibc in version 2.1.
165 This function had to be called "true gamma function"
166 since there is already a function
168 that returns something else (see
174 is negative infinity,
176 is not set (it should be set to
178 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
180 In glibc versions 2.3.3 and earlier,
181 an argument of +0 or \-0 incorrectly produced a domain error
187 exception raised), rather than a pole error.
192 This page is part of release 3.68 of the Linux
195 A description of the project,
196 information about reporting bugs,
197 and the latest version of this page,
199 \%http://www.kernel.org/doc/man\-pages/.