1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" Based on glibc infopages
4 .\" Modified 2004-11-15, fixed error noted by Fabian Kreutz
5 .\" <kreutz@dbs.uni-hannover.de>
6 .TH TGAMMA 3 2004-11-15 "GNU" "Linux Programmer's Manual"
8 tgamma, tgammaf, tgammal \- true gamma function
12 .BI "double tgamma(double " x );
14 .BI "float tgammaf(float " x );
16 .BI "long double tgammal(long double " x );
18 Compile with \-std=c99; link with \-lm.
20 The Gamma function is defined by
22 Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
24 It is defined for every real number except for non-positive integers.
25 For non-negative integral \fIm\fP one has
29 and, more generally, for all \fIx\fP:
31 Gamma(x+1) = x * Gamma(x)
33 Furthermore, the following is valid for all values of \fIx\fP
36 Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
38 This function returns the value of the Gamma function for the
40 It had to be called "true gamma function"
41 since there is already a function
43 that returns something else.
45 In order to check for errors, set
48 .I feclearexcept(FE_ALL_EXCEPT)
49 before calling these functions.
53 .I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
54 is non-zero, an error has occurred.
56 A range error occurs if x is too large.
57 A pole error occurs if x is zero.
58 A domain error (or a pole error) occurs if x is a negative integer.