OSDN Git Service

info/GNU_which: Add some explanations.
[linuxjm/jm.git] / manual / LDP_man-pages / 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 2020\-06\-09 "" "Linux Programmer's Manual"
48 .SH 名前
49 pow, powf, powl \- 累乗関数
50 .SH 書式
51 .nf
52 \fB#include <math.h>\fP
53 .PP
54 \fBdouble pow(double \fP\fIx\fP\fB, double \fP\fIy\fP\fB);\fP
55 \fBfloat powf(float \fP\fIx\fP\fB, float \fP\fIy\fP\fB);\fP
56 \fBlong double powl(long double \fP\fIx\fP\fB, long double \fP\fIy\fP\fB);\fP
57 .fi
58 .PP
59 \fI\-lm\fP でリンクする。
60 .PP
61 .RS -4
62 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
63 .RE
64 .PP
65 .ad l
66 \fBpowf\fP(), \fBpowl\fP():
67 .RS 4
68 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
69     || /* Since glibc 2.19: */ _DEFAULT_SOURCE
70     || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
71 .RE
72 .ad
73 .SH 説明
74 これらの関数は \fIx\fP の \fIy\fP 乗の値を返す。
75 .SH 返り値
76 成功すると、これらの関数は \fIx\fP の \fIy\fP 乗の値を返す。
77 .PP
78 .\" The domain error is generated at least as far back as glibc 2.4
79 \fIx\fP が 0 未満の有限値で \fIy\fP が整数でない有限値の場合、領域エラー (domain error) が発生し、 NaN が返される。
80 .PP
81 .\" The range error is generated at least as far back as glibc 2.4
82 結果がオーバーフローする場合、 範囲エラー (range error) が発生し、 各関数はそれぞれ \fBHUGE_VAL\fP,
83 \fBHUGE_VALF\fP, \fBHUGE_VALL\fP を返す。返り値には数学的に正しい符号が付与される。
84 .PP
85 .\" POSIX.1 does not specify the sign of the zero,
86 .\" but http://sources.redhat.com/bugzilla/show_bug.cgi?id=2678
87 .\" points out that the zero has the wrong sign in some cases.
88 結果がアンダーフローし、その値が表現可能でない場合、 範囲エラーが発生し、 0.0 が返される。
89 .PP
90 以下で規定されていない場合で、 \fIx\fP か \fIy\fP が NaN の場合、返り値は NaN となる。
91 .PP
92 \fIx\fP が +1 の場合、 (\fIy\fP が NaN であったとしても) 返り値は 1.0 となる。
93 .PP
94 \fIy\fP が 0 の場合、 (\fIx\fP が NaN であったとしても) 返り値は 1.0 となる。
95 .PP
96 \fIx\fP が +0 (\-0) で \fIy\fP が 0 より大きな奇数の場合、返り値は +0 (\-0) となる。
97 .PP
98 \fIx\fP が 0 で、 \fIy\fP が 0 より大きく奇数でない場合、返り値は +0 となる。
99 .PP
100 \fIx\fP が \-1 で、 \fIy\fP が正の無限大か負の無限大の場合、返り値は 1.0 となる。
101 .PP
102 \fIx\fP の絶対値が 1 未満で、 \fIy\fP が負の無限大の場合、返り値は正の無限大となる。
103 .PP
104 \fIx\fP 絶対値が 1 より大きく、 \fIy\fP が負の無限大の場合、返り値は +0 となる。
105 .PP
106 \fIx\fP の絶対値が 1 未満で、 \fIy\fP が正の無限大の場合、返り値は +0 となる。
107 .PP
108 \fIx\fP の絶対値が 1 より大きく、 \fIy\fP が正の無限大の場合、返り値は正の無限大となる。
109 .PP
110 \fIx\fP が負の無限大で、 \fIy\fP が 0 より小さい奇数の場合、返り値は \-0 となる。
111 .PP
112 \fIx\fP が負の無限大で、 \fIy\fP が 0 より小さく奇数でない場合、返り値は +0 となる。
113 .PP
114 \fIx\fP が負の無限大で、 \fIy\fP が 0 より大きい奇数の場合、返り値は負の無限大となる。
115 .PP
116 \fIx\fP が負の無限大で、 \fIy\fP が 0 より大きく奇数でない場合、返り値は正の無限大となる。
117 .PP
118 \fIx\fP が正の無限大で、 \fIy\fP が 0 未満の場合、返り値は +0 となる。
119 .PP
120 \fIx\fP が正の無限大で、 \fIy\fP が 0 より大きい場合、返り値は正の無限大となる。
121 .PP
122 \fIx\fP が +0 か \-0 で、 \fIy\fP が 0 より小さい奇数の場合、 極エラー (pole error) が発生し、返り値は
123 \fBHUGE_VAL\fP, \fBHUGE_VALF\fP, \fBHUGE_VALL\fP となる。 \fIx\fP と同じ符号が付与される。
124 .PP
125 .\" The pole error is generated at least as far back as glibc 2.4
126 \fIx\fP が +0 か \-0 で、 \fIy\fP が 0 より小さく奇数でない場合、 極エラーが発生し、 返り値は \fB+\fPHUGE_VAL\fB,\fP
127 \fB+\fPHUGE_VALF\fB,\fP \fB+\fPHUGE_VALL となる。
128 .SH エラー
129 .\" FIXME . review status of this error
130 .\" longstanding bug report for glibc:
131 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
132 .\" For negative x, and -large and +large y, glibc 2.8 gives incorrect
133 .\" results
134 .\" pow(-0.5,-DBL_MAX)=nan
135 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
136 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
137 .\"
138 .\" pow(-1.5,-DBL_MAX)=nan
139 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
140 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
141 .\"
142 .\" pow(-0.5,DBL_MAX)=nan
143 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
144 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
145 .\"
146 .\" pow(-1.5,DBL_MAX)=nan
147 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
148 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
149 これらの関数を呼び出した際にエラーが発生したかの判定方法についての情報は \fBmath_error\fP(7)  を参照のこと。
150 .PP
151 以下のエラーが発生する可能性がある。
152 .TP 
153 領域エラー: \fIx\fP が負で、\fIy\fP が整数でない有限値
154 \fIerrno\fP に \fBEDOM\fP が設定される。 不正 (invalid) 浮動小数点例外 (\fBFE_INVALID\fP)  が上がる。
155 .TP 
156 極エラー: \fIx\fP がゼロで、\fIy\fP が負
157 \fIerrno\fP に \fBERANGE\fP が設定される (「バグ」の節も参照)。 0 による除算 (divide\-by\-zero) 浮動小数点例外
158 (\fBFE_DIVBYZERO\fP)  が上がる。
159 .TP 
160 範囲エラー: 結果がオーバーフロー
161 \fIerrno\fP に \fBERANGE\fP が設定される。 オーバーフロー浮動小数点例外 (\fBFE_OVERFLOW\fP)  が上がる。
162 .TP 
163 範囲エラー: 結果がアンダーフロー
164 \fIerrno\fP に \fBERANGE\fP が設定される。 アンダーフロー浮動小数点例外 (\fBFE_UNDERFLOW\fP)  が上がる。
165 .SH 属性
166 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。
167 .TS
168 allbox;
169 lbw21 lb lb
170 l l l.
171 インターフェース        属性  値
172 T{
173 \fBpow\fP(),
174 \fBpowf\fP(),
175 \fBpowl\fP()
176 T}      Thread safety   MT\-Safe
177 .TE
178 .SH 準拠
179 C99, POSIX.1\-2001, POSIX.1\-2008.
180 .PP
181 \fIdouble\fP 版の関数は SVr4, 4.3BSD, C89 にも準拠している。
182 .SH バグ
183 .SS "Historical bugs (now fixed)"
184 .\" https://sourceware.org/bugzilla/show_bug.cgi?id=13932
185 .\" commit c3d466cba1692708a19c6ff829d0386c83a0c6e5
186 バージョン 2.28 より前の glibc では、 (x86\-64 などの) いくつかのアーキテクチャーでは、 \fBpow\fP は、特定の (ごく稀な)
187 入力に対して、その直近の似たような数字の場合と比べて 10000 倍以上遅くなることがある。 これは \fBpow\fP() でのみ起こることであり、
188 \fBpowf\fP() や \fBpowl\fP() では起こらない。この問題は glibc 2.28 で修正された。
189 .PP
190 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
191 A number of bugs in the glibc implementation of \fBpow\fP()  were fixed in
192 glibc version 2.16.
193 .PP
194 .\"
195 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6776
196 .\" or possibly 2.9, I haven't found the source code change
197 .\" and I don't have a 2.9 system to test
198 glibc 2.9 とそれ以前のバージョンでは、 極エラーが発生した場合、POSIX で要求されている \fBERANGE\fP ではなく \fBEDOM\fP が
199 \fIerrno\fP に設定される。 バージョン 2.10 以降の glibc では、正しい動作をする。
200 .PP
201 .\" Actually, 2.3.2 is the earliest test result I have; so yet
202 .\" to confirm if this error occurs only in 2.3.2.
203 glibc バージョン 2.3.2 以前では、 アンダーフローやアンダーフローのエラーが発生する場合、 glibc の \fBpow\fP()
204 は、オーバーフロー例外やアンダーフロー例外を上げるだけでなく、 不正浮動小数点例外 (\fBFE_INVALID\fP)  を間違って発生する。
205 .SH 関連項目
206 \fBcbrt\fP(3), \fBcpow\fP(3), \fBsqrt\fP(3)
207 .SH この文書について
208 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
209 \%https://www.kernel.org/doc/man\-pages/ に書かれている。