OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / original / man3 / tgamma.3
1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" Based on glibc infopages
4 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
5 .\"     <mtk.manpages@gmail.com>
6 .\" Modified 2004-11-15, fixed error noted by Fabian Kreutz
7 .\"      <kreutz@dbs.uni-hannover.de>
8 .TH TGAMMA 3 2008-08-11 "GNU" "Linux Programmer's Manual"
9 .SH NAME
10 tgamma, tgammaf, tgammal \- true gamma function
11 .SH SYNOPSIS
12 .B #include <math.h>
13 .sp
14 .BI "double tgamma(double " x );
15 .br
16 .BI "float tgammaf(float " x );
17 .br
18 .BI "long double tgammal(long double " x );
19 .sp
20 Link with \fI\-lm\fP.
21 .sp
22 .in -4n
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
25 .in
26 .sp
27 .ad l
28 .BR tgamma (),
29 .BR tgammaf (),
30 .BR tgammal ():
31 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
32 .I cc\ -std=c99
33 .ad b
34 .SH DESCRIPTION
35 The Gamma function is defined by
36 .sp
37     Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
38 .sp
39 It is defined for every real number except for nonpositive integers.
40 For nonnegative integral \fIm\fP one has
41 .sp
42     Gamma(m+1) = m!
43 .sp
44 and, more generally, for all \fIx\fP:
45 .sp
46     Gamma(x+1) = x * Gamma(x)
47 .sp
48 Furthermore, the following is valid for all values of \fIx\fP
49 outside the poles:
50 .sp
51     Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x)
52 .PP
53 .SH RETURN VALUE
54 On success, these functions return Gamma(x).
55
56 If
57 .I x
58 is a NaN, a NaN is returned.
59
60 If
61 .I x
62 is positive infinity, positive infinity is returned.
63
64 If
65 .I x
66 is a negative integer, or is negative infinity,
67 a domain error occurs,
68 and a NaN is returned.
69
70 If the result overflows,
71 a range error occurs,
72 and the functions return
73 .BR HUGE_VAL ,
74 .BR HUGE_VALF ,
75 or
76 .BR HUGE_VALL ,
77 respectively, with the correct mathematical sign.
78
79 If the result underflows,
80 a range error occurs,
81 and the functions return 0, with the correct mathematical sign.
82
83 If
84 .I x
85 is -0 or +0,
86 a pole error occurs,
87 and the functions return
88 .BR HUGE_VAL ,
89 .BR HUGE_VALF ,
90 or
91 .BR HUGE_VALL ,
92 respectively, with the same sign as the 0.
93 .SH ERRORS
94 See
95 .BR math_error (7)
96 for information on how to determine whether an error has occurred
97 when calling these functions.
98 .PP
99 The following errors can occur:
100 .TP
101 Domain error: \fIx\fP is a negative integer, or negative infinity
102 .\" FIXME . errno is not set to EDOM for x == -inf
103 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
104 .I errno
105 is set to
106 .BR EDOM .
107 An invalid floating-point exception
108 .RB ( FE_INVALID )
109 is raised (but see BUGS).
110 .TP
111 Pole error: \fIx\fP is +0 or \-0
112 .I errno
113 is set to
114 .BR ERANGE .
115 A divide-by-zero floating-point exception
116 .RB ( FE_DIVBYZERO )
117 is raised.
118 .TP
119 Range error: result overflow
120 .I errno
121 is set to
122 .BR ERANGE .
123 An overflow floating-point exception
124 .RB ( FE_OVERFLOW )
125 is raised.
126 .PP
127 glibc also gives the following error which is not specified
128 in C99 or POSIX.1-2001.
129 .TP
130 Range error: result underflow
131 .\" e.g., tgamma(-172.5) on glibc 2.8/x86-32
132 .\" .I errno
133 .\" is set to
134 .\" .BR ERANGE .
135 An underflow floating-point exception
136 .RB ( FE_UNDERFLOW )
137 is raised.
138 .IP
139 .I errno
140 is not set for this case.
141 .\" FIXME . Is it intentional that errno is not set:
142 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6810
143 .\"
144 .\" glibc (as at 2.8) also supports and an inexact
145 .\" exception for various cases.
146 .SH VERSIONS
147 These functions first appeared in glibc in version 2.1.
148 .SH "CONFORMING TO"
149 C99, POSIX.1-2001.
150 .SH NOTES
151 This function had to be called "true gamma function"
152 since there is already a function
153 .BR gamma (3)
154 that returns something else (see
155 .BR gamma (3)
156 for details).
157 .SH BUGS
158 If
159 .I x
160 is negative infinity,
161 .I errno
162 is not set (it should be set to
163 .BR EDOM ).
164 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809
165
166 In glibc versions 2.3.3 and earlier,
167 an argument of +0 or -0 incorrectly produced a domain error
168 .RI ( errno
169 set to
170 .B EDOM
171 and an
172 .B FE_INVALID
173 exception raised), rather than a pole error.
174 .SH "SEE ALSO"
175 .BR gamma (3),
176 .BR lgamma (3)