]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de) |
2297bf0e | 2 | .\" |
38f20bb9 | 3 | .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE) |
fea681da | 4 | .\" Distributed under GPL |
38f20bb9 | 5 | .\" %%%LICENSE_END |
e787eaba | 6 | .\" |
fea681da | 7 | .\" Based on glibc infopages |
cf8b7bc8 MK |
8 | .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
9 | .\" <mtk.manpages@gmail.com> | |
fe71be4b MK |
10 | .\" Modified 2004-11-15, fixed error noted by Fabian Kreutz |
11 | .\" <kreutz@dbs.uni-hannover.de> | |
e787eaba | 12 | .\" |
4b8c67d9 | 13 | .TH TGAMMA 3 2017-09-15 "GNU" "Linux Programmer's Manual" |
fea681da MK |
14 | .SH NAME |
15 | tgamma, tgammaf, tgammal \- true gamma function | |
16 | .SH SYNOPSIS | |
17 | .B #include <math.h> | |
68e4db0a | 18 | .PP |
fea681da MK |
19 | .BI "double tgamma(double " x ); |
20 | .br | |
21 | .BI "float tgammaf(float " x ); | |
22 | .br | |
23 | .BI "long double tgammal(long double " x ); | |
68e4db0a | 24 | .PP |
cc4615cc | 25 | Link with \fI\-lm\fP. |
68e4db0a | 26 | .PP |
cc4615cc MK |
27 | .in -4n |
28 | Feature Test Macro Requirements for glibc (see | |
29 | .BR feature_test_macros (7)): | |
30 | .in | |
68e4db0a | 31 | .PP |
cc4615cc MK |
32 | .ad l |
33 | .BR tgamma (), | |
34 | .BR tgammaf (), | |
35 | .BR tgammal (): | |
def430aa | 36 | .RS 4 |
e464f054 MK |
37 | _ISOC99_SOURCE || |
38 | _POSIX_C_SOURCE\ >=\ 200112L | |
def430aa MK |
39 | .RE |
40 | .ad | |
fea681da | 41 | .SH DESCRIPTION |
5600f73a MK |
42 | These functions calculate the Gamma function of |
43 | .IR x . | |
847e0d88 | 44 | .PP |
fea681da | 45 | The Gamma function is defined by |
bdd915e2 MK |
46 | .PP |
47 | .RS | |
48 | Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt | |
49 | .RE | |
50 | .PP | |
657316c0 | 51 | It is defined for every real number except for nonpositive integers. |
022671eb MK |
52 | For nonnegative integral |
53 | .I m | |
54 | one has | |
bdd915e2 MK |
55 | .PP |
56 | .RS | |
57 | Gamma(m+1) = m! | |
58 | .RE | |
59 | .PP | |
022671eb MK |
60 | and, more generally, for all |
61 | .IR x : | |
bdd915e2 MK |
62 | .PP |
63 | .RS | |
64 | Gamma(x+1) = x * Gamma(x) | |
65 | .RE | |
66 | .PP | |
022671eb MK |
67 | Furthermore, the following is valid for all values of |
68 | .I x | |
fe71be4b | 69 | outside the poles: |
bdd915e2 MK |
70 | .PP |
71 | .RS | |
72 | Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x) | |
a3847715 | 73 | .RE |
cf8b7bc8 MK |
74 | .SH RETURN VALUE |
75 | On success, these functions return Gamma(x). | |
847e0d88 | 76 | .PP |
cf8b7bc8 MK |
77 | If |
78 | .I x | |
79 | is a NaN, a NaN is returned. | |
847e0d88 | 80 | .PP |
cf8b7bc8 | 81 | If |
cab87712 | 82 | .I x |
cf8b7bc8 | 83 | is positive infinity, positive infinity is returned. |
847e0d88 | 84 | .PP |
cf8b7bc8 | 85 | If |
cab87712 | 86 | .I x |
cf8b7bc8 | 87 | is a negative integer, or is negative infinity, |
efe294cb | 88 | a domain error occurs, |
cf8b7bc8 | 89 | and a NaN is returned. |
847e0d88 | 90 | .PP |
cf8b7bc8 | 91 | If the result overflows, |
efe294cb | 92 | a range error occurs, |
cf8b7bc8 MK |
93 | and the functions return |
94 | .BR HUGE_VAL , | |
95 | .BR HUGE_VALF , | |
96 | or | |
97 | .BR HUGE_VALL , | |
98 | respectively, with the correct mathematical sign. | |
847e0d88 | 99 | .PP |
cf8b7bc8 | 100 | If the result underflows, |
efe294cb | 101 | a range error occurs, |
cf8b7bc8 | 102 | and the functions return 0, with the correct mathematical sign. |
847e0d88 | 103 | .PP |
cf8b7bc8 | 104 | If |
cab87712 | 105 | .I x |
c3074d70 | 106 | is \-0 or +0, |
efe294cb | 107 | a pole error occurs, |
cf8b7bc8 MK |
108 | and the functions return |
109 | .BR HUGE_VAL , | |
110 | .BR HUGE_VALF , | |
111 | or | |
112 | .BR HUGE_VALL , | |
113 | respectively, with the same sign as the 0. | |
114 | .SH ERRORS | |
115 | See | |
116 | .BR math_error (7) | |
117 | for information on how to determine whether an error has occurred | |
118 | when calling these functions. | |
119 | .PP | |
120 | The following errors can occur: | |
121 | .TP | |