]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/tgamma.3
getauxval.3: wfix
[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.\"
c73595c2 13.TH TGAMMA 3 2015-04-19 "GNU" "Linux Programmer's Manual"
fea681da
MK
14.SH NAME
15tgamma, 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
25Link with \fI\-lm\fP.
26.sp
27.in -4n
28Feature 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
40or
cc4615cc 41.I cc\ -std=c99
def430aa
MK
42.RE
43.ad
fea681da 44.SH DESCRIPTION
5600f73a
MK
45These functions calculate the Gamma function of
46.IR x .
47
fea681da
MK
48The 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 52It is defined for every real number except for nonpositive integers.
022671eb
MK
53For nonnegative integral
54.I m
55one has
fea681da 56.sp
cf8b7bc8 57 Gamma(m+1) = m!
fea681da 58.sp
022671eb
MK
59and, more generally, for all
60.IR x :
fea681da 61.sp
cf8b7bc8 62 Gamma(x+1) = x * Gamma(x)
fea681da 63.sp
022671eb
MK
64Furthermore, the following is valid for all values of
65.I x
fe71be4b 66outside 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
71On success, these functions return Gamma(x).
72
73If
74.I x
75is a NaN, a NaN is returned.
76
77If
cab87712 78.I x
cf8b7bc8
MK
79is positive infinity, positive infinity is returned.
80
81If
cab87712 82.I x
cf8b7bc8 83is a negative integer, or is negative infinity,
efe294cb 84a domain error occurs,
cf8b7bc8
MK
85and a NaN is returned.
86
87If the result overflows,
efe294cb 88a range error occurs,
cf8b7bc8
MK
89and the functions return
90.BR HUGE_VAL ,
91.BR HUGE_VALF ,
92or
93.BR HUGE_VALL ,
94respectively, with the correct mathematical sign.
95
96If the result underflows,
efe294cb 97a range error occurs,
cf8b7bc8
MK
98and the functions return 0, with the correct mathematical sign.
99
100If
cab87712 101.I x
c3074d70 102is \-0 or +0,
efe294cb 103a pole error occurs,
cf8b7bc8
MK
104and the functions return
105.BR HUGE_VAL ,
106.BR HUGE_VALF ,
107or
108.BR HUGE_VALL ,
109respectively, with the same sign as the 0.
110.SH ERRORS
111See
112.BR math_error (7)
113for information on how to determine whether an error has occurred
114when calling these functions.
115.PP
116The following errors can occur:
117.TP