1TGAMMA(3) libc math functions TGAMMA(3)
2
3
4
6 tgamma, tgammaf, tgammal - true gamma function
7
9 #include <math.h>
10
11 double tgamma(double x);
12 float tgammaf(float x);
13 long double tgammal(long double x);
14
15 Compile with -std=c99; link with -lm.
16
18 The Gamma function is defined by
19
20 Gamma(x) = integral from 0 to infinity of t^(x-1) e^-t dt
21
22 It is defined for every real number except for non-positive integers.
23 For nonnegative integral m one has
24
25 Gamma(m+1) = m!
26
27 and, more generally, for all x:
28
29 Gamma(x+1) = x * Gamma(x)
30
31 Furthermore, the following is valid for all values of x outside the
32 poles:
33
34 Gamma(x) * Gamma(1-x) = PI/sin(PI*x)
35
36 This function returns the value of the Gamma function for the argument
37 x. It had to be called "true gamma function" since there is already a
38 function gamma() that returns something else.
39
41 In order to check for errors, set errno to zero and call feclearex‐
42 cept(FE_ALL_EXCEPT) before calling these functions. On return, if errno
43 is non-zero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW |
44 FE_UNDERFLOW) is non-zero, an error has occurred.
45
46 A range error occurs if x is too large. A pole error occurs if x is
47 zero. A domain error (or a pole error) occurs if x is a negative inte‐
48 ger.
49
51 C99.
52
54 gamma(3), lgamma(3)
55
56
57
58GNU 2004-11-15 TGAMMA(3)