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" "libc math functions"
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 nonpositive integers.
25 For nonnegative 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
39 argument \fIx\fP. It had to be called "true gamma function"
40 since there is already a function
42 that returns something else.
44 In order to check for errors, set
47 .I feclearexcept(FE_ALL_EXCEPT)
48 before calling these functions. On return, if
51 .I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
52 is non-zero, an error has occurred.
54 A range error occurs if x is too large.
55 A pole error occurs if x is zero.
56 A domain error (or a pole error) occurs if x is a negative integer.