]>
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 | .\" |
fe0fefbf | 13 | .TH TGAMMA 3 2015-03-02 "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> | |
18 | .sp | |
19 | .BI "double tgamma(double " x ); | |
20 | .br | |
21 | .BI "float tgammaf(float " x ); | |
22 | .br | |
23 | .BI "long double tgammal(long double " x ); | |
24 | .sp | |
cc4615cc MK |
25 | Link with \fI\-lm\fP. |
26 | .sp | |
27 | .in -4n | |
28 | Feature Test Macro Requirements for glibc (see | |
29 | .BR feature_test_macros (7)): | |
30 | .in | |
31 | .sp | |
32 | .ad l | |
33 | .BR tgamma (), | |
34 | .BR tgammaf (), | |
35 | .BR tgammal (): | |
def430aa | 36 | .RS 4 |
92d88135 MK |
37 | _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE || |
38 | _POSIX_C_SOURCE\ >=\ 200112L; | |
def430aa MK |
39 | .br |
40 | or | |
cc4615cc | 41 | .I cc\ -std=c99 |
def430aa MK |
42 | .RE |
43 | .ad | |
fea681da | 44 | .SH DESCRIPTION |
5600f73a MK |
45 | These functions calculate the Gamma function of |
46 | .IR x . | |
47 | ||
fea681da MK |
48 | The Gamma function is defined by |
49 | .sp | |
cf8b7bc8 | 50 | Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt |
fea681da | 51 | .sp |
657316c0 | 52 | It is defined for every real number except for nonpositive integers. |
022671eb MK |
53 | For nonnegative integral |
54 | .I m | |
55 | one has | |
fea681da | 56 | .sp |
cf8b7bc8 | 57 | Gamma(m+1) = m! |
fea681da | 58 | .sp |
022671eb MK |
59 | and, more generally, for all |
60 | .IR x : | |
fea681da | 61 | .sp |
cf8b7bc8 | 62 | Gamma(x+1) = x * Gamma(x) |
fea681da | 63 | .sp |
022671eb MK |
64 | Furthermore, the following is valid for all values of |
65 | .I x | |
fe71be4b | 66 | outside the poles: |
fea681da | 67 | .sp |
cf8b7bc8 | 68 | Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x) |
fea681da | 69 | .PP |
cf8b7bc8 MK |
70 | .SH RETURN VALUE |
71 | On success, these functions return Gamma(x). | |
72 | ||
73 | If | |
74 | .I x | |
75 | is a NaN, a NaN is returned. | |
76 | ||
77 | If | |
cab87712 | 78 | .I x |
cf8b7bc8 MK |
79 | is positive infinity, positive infinity is returned. |
80 | ||
81 | If | |
cab87712 | 82 | .I x |
cf8b7bc8 | 83 | is a negative integer, or is negative infinity, |
efe294cb | 84 | a domain error occurs, |
cf8b7bc8 MK |
85 | and a NaN is returned. |
86 | ||
87 | If the result overflows, | |
efe294cb | 88 | a range error occurs, |
cf8b7bc8 MK |
89 | and the functions return |
90 | .BR HUGE_VAL , | |
91 | .BR HUGE_VALF , | |
92 | or | |
93 | .BR HUGE_VALL , | |
94 | respectively, with the correct mathematical sign. | |
95 | ||
96 | If the result underflows, | |
efe294cb | 97 | a range error occurs, |
cf8b7bc8 MK |
98 | and the functions return 0, with the correct mathematical sign. |
99 | ||
100 | If | |
cab87712 | 101 | .I x |
c3074d70 | 102 | is \-0 or +0, |
efe294cb | 103 | a pole error occurs, |
cf8b7bc8 MK |
104 | and the functions return |
105 | .BR HUGE_VAL , | |
106 | .BR HUGE_VALF , | |
107 | or | |
108 | .BR HUGE_VALL , | |
109 | respectively, with the same sign as the 0. | |
110 | .SH ERRORS | |
111 | See | |
112 | .BR math_error (7) | |
113 | for information on how to determine whether an error has occurred | |
114 | when calling these functions. | |
115 | .PP | |
116 | The following errors can occur: | |
117 | .TP | |