]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/tgamma.3
system.3: ffix
[thirdparty/man-pages.git] / man3 / tgamma.3
CommitLineData
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
15tgamma, 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 25Link with \fI\-lm\fP.
68e4db0a 26.PP
cc4615cc
MK
27.in -4n
28Feature 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
42These functions calculate the Gamma function of
43.IR x .
847e0d88 44.PP
fea681da 45The Gamma function is defined by
bdd915e2
MK
46.PP
47.RS
48Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
49.RE
50.PP
657316c0 51It is defined for every real number except for nonpositive integers.
022671eb
MK
52For nonnegative integral
53.I m
54one has
bdd915e2
MK
55.PP
56.RS
57Gamma(m+1) = m!
58.RE
59.PP
022671eb
MK
60and, more generally, for all
61.IR x :
bdd915e2
MK
62.PP
63.RS
64Gamma(x+1) = x * Gamma(x)
65.RE
66.PP
022671eb
MK
67Furthermore, the following is valid for all values of
68.I x
fe71be4b 69outside the poles:
bdd915e2
MK
70.PP
71.RS
72Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
a3847715 73.RE
cf8b7bc8
MK
74.SH RETURN VALUE
75On success, these functions return Gamma(x).
847e0d88 76.PP
cf8b7bc8
MK
77If
78.I x
79is a NaN, a NaN is returned.
847e0d88 80.PP
cf8b7bc8 81If
cab87712 82.I x
cf8b7bc8 83is positive infinity, positive infinity is returned.
847e0d88 84.PP
cf8b7bc8 85If
cab87712 86.I x
cf8b7bc8 87is a negative integer, or is negative infinity,
efe294cb 88a domain error occurs,
cf8b7bc8 89and a NaN is returned.
847e0d88 90.PP
cf8b7bc8 91If the result overflows,
efe294cb 92a range error occurs,
cf8b7bc8
MK
93and the functions return
94.BR HUGE_VAL ,
95.BR HUGE_VALF ,
96or
97.BR HUGE_VALL ,
98respectively, with the correct mathematical sign.
847e0d88 99.PP
cf8b7bc8 100If the result underflows,
efe294cb 101a range error occurs,
cf8b7bc8 102and the functions return 0, with the correct mathematical sign.
847e0d88 103.PP
cf8b7bc8 104If
cab87712 105.I x
c3074d70 106is \-0 or +0,
efe294cb 107a pole error occurs,
cf8b7bc8
MK
108and the functions return
109.BR HUGE_VAL ,
110.BR HUGE_VALF ,
111or
112.BR HUGE_VALL ,
113respectively, with the same sign as the 0.
114.SH ERRORS
115See
116.BR math_error (7)
117for information on how to determine whether an error has occurred
118when calling these functions.
119.PP
120The following errors can occur:
121.TP