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 2014-12-31 "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
119 An invalid floating-point exception
121 is raised (but see BUGS).
123 Pole error: \fIx\fP is +0 or \-0
127 A divide-by-zero floating-point exception
131 Range error: result overflow
135 An overflow floating-point exception
139 glibc also gives the following error which is not specified
140 in C99 or POSIX.1-2001.
142 Range error: result underflow
143 .\" e.g., tgamma(-172.5) on glibc 2.8/x86-32
147 An underflow floating-point exception
152 is not set for this case.
153 .\" FIXME . Is it intentional that errno is not set:
154 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6810
156 .\" glibc (as at 2.8) also supports and an inexact
157 .\" exception for various cases.
159 These functions first appeared in glibc in version 2.1.
163 This function had to be called "true gamma function"
164 since there is already a function
166 that returns something else (see
170 Before version 2.18, the glibc implementation of these functions did not set
171 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
177 is negative infinity.
179 In glibc versions 2.3.3 and earlier,
180 an argument of +0 or \-0 incorrectly produced a domain error
186 exception raised), rather than a pole error.
191 This page is part of release 3.79 of the Linux
194 A description of the project,
195 information about reporting bugs,
196 and the latest version of this page,
198 \%http://www.kernel.org/doc/man\-pages/.