OSDN Git Service

(split) LDP: Release pages for LDP v3.39.
[linuxjm/LDP_man-pages.git] / release / man3 / pow.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 1995-08-14 by Arnt Gulbrandsen <agulbra@troll.no>
31 .\" Modified 2002-07-27 by Walter Harms
32 .\"     (walter.harms@informatik.uni-oldenburg.de)
33 .\"*******************************************************************
34 .\"
35 .\" This file was generated with po4a. Translate the source file.
36 .\"
37 .\"*******************************************************************
38 .TH POW 3 2010\-09\-12 "" "Linux Programmer's Manual"
39 .SH 名前
40 pow, powf, powl \- 累乗関数
41 .SH 書式
42 .nf
43 \fB#include <math.h>\fP
44 .sp
45 \fBdouble pow(double \fP\fIx\fP\fB, double \fP\fIy\fP\fB);\fP
46 .br
47 \fBfloat powf(float \fP\fIx\fP\fB, float \fP\fIy\fP\fB);\fP
48 .br
49 \fBlong double powl(long double \fP\fIx\fP\fB, long double \fP\fIy\fP\fB);\fP
50 .fi
51 .sp
52 \fI\-lm\fP でリンクする。
53 .sp
54 .in -4n
55 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
56 .in
57 .sp
58 .ad l
59 \fBpowf\fP(), \fBpowl\fP():
60 .RS 4
61 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE
62 || _POSIX_C_SOURCE\ >=\ 200112L;
63 .br
64 or \fIcc\ \-std=c99\fP
65 .RE
66 .ad
67 .SH 説明
68 \fBpow\fP()  関数は \fIx\fP の \fIy\fP 乗の値を返す。
69 .SH 返り値
70 成功すると、これらの関数は \fIx\fP の \fIy\fP 乗の値を返す。
71
72 .\" The domain error is generated at least as far back as glibc 2.4
73 \fIx\fP が 0 未満の有限値で \fIy\fP が整数でない有限値の場合、領域エラー (domain error) が発生し、 NaN が返される。
74
75 .\" The range error is generated at least as far back as glibc 2.4
76 結果がオーバーフローする場合、 範囲エラー (range error) が発生し、 各関数はそれぞれ \fBHUGE_VAL\fP,
77 \fBHUGE_VALF\fP, \fBHUGE_VALL\fP を返す。返り値には数学的に正しい符号が付与される。
78
79 .\" POSIX.1 does not specify the sign of the zero,
80 .\" but http://sources.redhat.com/bugzilla/show_bug.cgi?id=2678
81 .\" points out that the zero has the wrong sign in some cases.
82 結果がアンダーフローし、その値が表現可能でない場合、 範囲エラーが発生し、 0.0 が返される。
83
84 以下で規定されていない場合で、 \fIx\fP か \fIy\fP が NaN の場合、返り値は NaN となる。
85
86 \fIx\fP が +1 の場合、 (\fIy\fP が NaN であったとしても) 返り値は 1.0 となる。
87
88 \fIy\fP が 0 の場合、 (\fIx\fP が NaN であったとしても) 返り値は 1.0 となる。
89
90 \fIx\fP が +0 (\-0) で \fIy\fP が 0 より大きな奇数の場合、返り値は +0 (\-0) となる。
91
92 \fIx\fP が 0 で、 \fIy\fP が 0 より大きく奇数でない場合、返り値は +0 となる。
93
94 \fIx\fP が \-1 で、 \fIy\fP が正の無限大か負の無限大の場合、返り値は 1.0 となる。
95
96 \fIx\fP の絶対値が 1 未満で、 \fIy\fP が負の無限大の場合、返り値は正の無限大となる。
97
98 \fIx\fP 絶対値が 1 より大きく、 \fIy\fP が負の無限大の場合、返り値は +0 となる。
99
100 \fIx\fP の絶対値が 1 未満で、 \fIy\fP が正の無限大の場合、返り値は +0 となる。
101
102 \fIx\fP の絶対値が 1 より大きく、 \fIy\fP が正の無限大の場合、返り値は正の無限大となる。
103
104 \fIx\fP が負の無限大で、 \fIy\fP が 0 より小さい奇数の場合、返り値は \-0 となる。
105
106 \fIx\fP が負の無限大で、 \fIy\fP が 0 より小さく奇数でない場合、返り値は +0 となる。
107
108 \fIx\fP が負の無限大で、 \fIy\fP が 0 より大きい奇数の場合、返り値は負の無限大となる。
109
110 \fIx\fP が負の無限大で、 \fIy\fP が 0 より大きく奇数でない場合、返り値は正の無限大となる。
111
112 \fIx\fP が正の無限大で、 \fIy\fP が 0 未満の場合、返り値は +0 となる。
113
114 \fIx\fP が正の無限大で、 \fIy\fP が 0 より大きい場合、返り値は正の無限大となる。
115
116 \fIx\fP が +0 か \-0 で、 \fIy\fP が 0 より小さい奇数の場合、 極エラー (pole error) が発生し、返り値は
117 \fBHUGE_VAL\fP, \fBHUGE_VALF\fP, \fBHUGE_VALL\fP となる。 \fIx\fP と同じ符号が付与される。
118
119 .\" The pole error is generated at least as far back as glibc 2.4
120 \fIx\fP が +0 か \-0 で、 \fIy\fP が 0 より小さく奇数でない場合、 極エラーが発生し、 返り値は \fB+\fPHUGE_VAL\fB,\fP
121 \fB+\fPHUGE_VALF\fB,\fP \fB+\fPHUGE_VALL となる。
122 .SH エラー
123 .\" FIXME . review status of this error
124 .\" longstanding bug report for glibc:
125 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
126 .\" For negative x, and -large and +large y, glibc 2.8 gives incorrect
127 .\" results
128 .\" pow(-0.5,-DBL_MAX)=nan
129 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
130 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
131 .\"
132 .\" pow(-1.5,-DBL_MAX)=nan
133 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
134 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
135 .\"
136 .\" pow(-0.5,DBL_MAX)=nan
137 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
138 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
139 .\"
140 .\" pow(-1.5,DBL_MAX)=nan
141 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
142 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
143 これらの関数を呼び出した際にエラーが発生したかの判定方法についての情報は \fBmath_error\fP(7)  を参照のこと。
144 .PP
145 以下のエラーが発生する可能性がある。
146 .TP 
147 領域エラー: \fIx\fP が負で、\fIy\fP が整数でない有限値
148 \fIerrno\fP に \fBEDOM\fP が設定される。 不正 (invalid) 浮動小数点例外 (\fBFE_INVALID\fP)  が上がる。
149 .TP 
150 極エラー: \fIx\fP がゼロで、\fIy\fP が負
151 \fIerrno\fP に \fBERANGE\fP が設定される (「バグ」の節も参照)。 0 による除算 (divide\-by\-zero) 浮動小数点例外
152 (\fBFE_DIVBYZERO\fP)  が上がる。
153 .TP 
154 範囲エラー: 結果がオーバーフロー
155 \fIerrno\fP に \fBERANGE\fP が設定される。 オーバーフロー浮動小数点例外 (\fBFE_OVERFLOW\fP)  が上がる。
156 .TP 
157 範囲エラー: 結果がアンダーフロー
158 \fIerrno\fP に \fBERANGE\fP が設定される。 アンダーフロー浮動小数点例外 (\fBFE_UNDERFLOW\fP)  が上がる。
159 .SH 準拠
160 C99, POSIX.1\-2001.  \fIdouble\fP 版の関数は SVr4, 4.3BSD, C89 にも準拠している。
161 .SH バグ
162 .\"
163 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6776
164 .\" or possibly 2.9, I haven't found the source code change
165 .\" and I don't have a 2.9 system to test
166 glibc 2.9 とそれ以前のバージョンでは、 極エラーが発生した場合、POSIX で要求されている \fBERANGE\fP ではなく \fBEDOM\fP が
167 \fIerrno\fP に設定される。 バージョン 2.10 以降の glibc では、正しい動作をする。
168
169 .\" see bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
170 .\" and http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
171 \fIx\fP が負の場合、大きな正負の値の \fIy\fP が与えられると、関数の結果が NaN となり、 \fIerrno\fP に \fBEDOM\fP が設定され、
172 不正浮動小数点例外 (\fBFE_INVALID\fP)  が発生する。 例えば、 \fBpow\fP()  では、 \fIy\fP の絶対値が約 9.223373e18
173 より大きい場合にこの状況となる。
174
175 .\" FIXME . Actually, 2.3.2 is the earliest test result I have; so yet
176 .\" to confirm if this error occurs only in 2.3.2.
177 glibc バージョン 2.3.2 以前では、 アンダーフローやアンダーフローのエラーが発生する場合、 glibc の \fBpow\fP()
178 は、オーバーフロー例外やアンダーフロー例外を上げるだけでなく、 不正浮動小数点例外 (\fBFE_INVALID\fP)  を間違って発生する。
179 .SH 関連項目
180 \fBcbrt\fP(3), \fBcpow\fP(3), \fBsqrt\fP(3)