summaryrefslogtreecommitdiff
path: root/man3/tgamma.3
blob: 12a1ab5dced03fd83dbf715f0bd2bca8e79dab00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\" Based on glibc infopages
.\" Modified 2004-11-15, fixed error noted by Fabian Kreutz
.\"	 <kreutz@dbs.uni-hannover.de>
.TH TGAMMA 3 2007-07-26 "GNU" "Linux Programmer's Manual"
.SH NAME
tgamma, tgammaf, tgammal \- true gamma function
.SH SYNOPSIS
.B #include <math.h>
.sp
.BI "double tgamma(double " x );
.br
.BI "float tgammaf(float " x );
.br
.BI "long double tgammal(long double " x );
.sp
Link with \fI\-lm\fP.
.sp
.in -4n
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.sp
.ad l
.BR tgamma (),
.BR tgammaf (),
.BR tgammal ():
_XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
.I cc\ -std=c99
.ad b
.SH DESCRIPTION
The Gamma function is defined by
.sp
 Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
.sp
It is defined for every real number except for non-positive integers.
For non-negative integral \fIm\fP one has
.sp
 Gamma(m+1) = m!
.sp
and, more generally, for all \fIx\fP:
.sp
 Gamma(x+1) = x * Gamma(x)
.sp
Furthermore, the following is valid for all values of \fIx\fP
outside the poles:
.sp
 Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
.PP
This function returns the value of the Gamma function for the
argument \fIx\fP.
It had to be called "true gamma function"
since there is already a function
.BR gamma (3)
that returns something else.
.SH ERRORS
In order to check for errors, set
.I errno
to zero and call
.I feclearexcept(FE_ALL_EXCEPT)
before calling these functions.
On return, if
.I errno
is non-zero or
.I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
is non-zero, an error has occurred.
.LP
A range error occurs if
.I x
is too large.
A pole error occurs if
.I x
is zero.
A domain error (or a pole error) occurs if
.I x
is a negative integer.
.SH "CONFORMING TO"
C99.
.SH "SEE ALSO"
.BR gamma (3),
.BR lgamma (3)