OSDN Git Service

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