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>
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.
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.
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
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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)
34 .\" Japanese Version Copyright (c) 2003, 2008 Akihiro MOTOKI
35 .\" all rights reserved.
36 .\" Translated Mon Sep 7 23:27:52 JST 2003
37 .\" by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
38 .\" Updated 2008-09-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
40 .TH POW 3 2010-09-12 "" "Linux Programmer's Manual"
43 .\"O pow, powf, powl \- power functions
44 pow, powf, powl \- Îß¾è´Ø¿ô
50 .BI "double pow(double " x ", double " y );
52 .BI "float powf(float " x ", float " y );
54 .BI "long double powl(long double " x ", long double " y );
57 .\"O Link with \fI\-lm\fP.
58 \fI\-lm\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
61 .\"O Feature Test Macro Requirements for glibc (see
62 .\"O .BR feature_test_macros (7)):
63 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
64 .RB ( feature_test_macros (7)
72 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
73 _POSIX_C_SOURCE\ >=\ 200112L;
83 .\"O function returns the value of \fIx\fP raised to the
84 .\"O power of \fIy\fP.
86 ´Ø¿ô¤Ï \fIx\fP ¤Î \fIy\fP ¾è¤ÎÃͤòÊÖ¤¹¡£
89 .\"O On success, these functions return the value of
93 À®¸ù¤¹¤ë¤È¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï
101 .\"O is a finite value less than 0, and
103 .\"O is a finite noninteger, a domain error occurs,
107 ¤¬À°¿ô¤Ç¤Ê¤¤Í¸ÂÃͤξì¹ç¡¢Îΰ襨¥é¡¼ (domain error) ¤¬È¯À¸¤·¡¢
108 .\" The domain error is generated at least as far back as glibc 2.4
109 .\"O and a NaN is returned.
112 .\"O If the result overflows,
113 .\"O a range error occurs,
114 ·ë²Ì¤¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤¹¤ë¾ì¹ç¡¢
115 ÈÏ°Ï¥¨¥é¡¼ (range error) ¤¬È¯À¸¤·¡¢
116 .\" The range error is generated at least as far back as glibc 2.4
117 .\"O and the functions return
122 .\"O respectively, with the mathematically correct sign.
127 ¤òÊÖ¤¹¡£ÊÖ¤êÃͤˤϿô³ØŪ¤ËÀµ¤·¤¤Éä¹æ¤¬ÉÕÍ¿¤µ¤ì¤ë¡£
129 .\"O If result underflows, and is not representable,
130 .\"O a range error occurs,
131 .\"O and 0.0 is returned.
132 ·ë²Ì¤¬¥¢¥ó¥À¡¼¥Õ¥í¡¼¤·¡¢¤½¤ÎÃͤ¬É½¸½²Äǽ¤Ç¤Ê¤¤¾ì¹ç¡¢
133 ÈÏ°Ï¥¨¥é¡¼¤¬È¯À¸¤·¡¢ 0.0 ¤¬ÊÖ¤µ¤ì¤ë¡£
134 .\" POSIX.1 does not specify the sign of the zero,
135 .\" but http://sources.redhat.com/bugzilla/show_bug.cgi?id=2678
136 .\" points out that the zero has the wrong sign in some cases.
138 .\"O Except as specified below, if
142 .\"O is a NaN, the result is a NaN.
143 °Ê²¼¤Çµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ç¡¢
147 ¤¬ NaN ¤Î¾ì¹ç¡¢ÊÖ¤êÃÍ¤Ï NaN ¤È¤Ê¤ë¡£
151 .\"O is +1, the result is 1.0 (even if
157 ¤¬ NaN ¤Ç¤¢¤Ã¤¿¤È¤·¤Æ¤â) ÊÖ¤êÃÍ¤Ï 1.0 ¤È¤Ê¤ë¡£
161 .\"O is 0, the result is 1.0 (even if
167 ¤¬ NaN ¤Ç¤¢¤Ã¤¿¤È¤·¤Æ¤â) ÊÖ¤êÃÍ¤Ï 1.0 ¤È¤Ê¤ë¡£
174 .\"O is an odd integer greater than 0,
175 .\"O the result is +0 (\-0).
179 ¤¬ 0 ¤è¤êÂ礤ʴñ¿ô¤Î¾ì¹ç¡¢ÊÖ¤êÃÍ¤Ï +0 (\-0) ¤È¤Ê¤ë¡£
186 .\"O greater than 0 and not an odd integer,
187 .\"O the result is +0.
191 ¤¬ 0 ¤è¤êÂ礤¯´ñ¿ô¤Ç¤Ê¤¤¾ì¹ç¡¢ÊÖ¤êÃÍ¤Ï +0 ¤È¤Ê¤ë¡£
198 .\"O is positive infinity or negative infinity,
199 .\"O the result is 1.0.
203 ¤¬Àµ¤Î̵¸ÂÂ礫Éé¤Î̵¸ÂÂç¤Î¾ì¹ç¡¢ÊÖ¤êÃÍ¤Ï 1.0 ¤È¤Ê¤ë¡£
205 .\"O If the absolute value of
210 .\"O is negative infinity,
211 .\"O the result is positive infinity.
213 ¤ÎÀäÂÐÃͤ¬ 1 ̤Ëþ¤Ç¡¢
215 ¤¬Éé¤Î̵¸ÂÂç¤Î¾ì¹ç¡¢ÊÖ¤êÃͤÏÀµ¤Î̵¸ÂÂç¤È¤Ê¤ë¡£
217 .\"O If the absolute value of
219 .\"O is greater than 1,
222 .\"O is negative infinity,
223 .\"O the result is +0.
225 ÀäÂÐÃͤ¬ 1 ¤è¤êÂ礤¯¡¢
227 ¤¬Éé¤Î̵¸ÂÂç¤Î¾ì¹ç¡¢ÊÖ¤êÃÍ¤Ï +0 ¤È¤Ê¤ë¡£
229 .\"O If the absolute value of
234 .\"O is positive infinity,
235 .\"O the result is +0.
237 ¤ÎÀäÂÐÃͤ¬ 1 ̤Ëþ¤Ç¡¢
239 ¤¬Àµ¤Î̵¸ÂÂç¤Î¾ì¹ç¡¢ÊÖ¤êÃÍ¤Ï +0 ¤È¤Ê¤ë¡£
241 .\"O If the absolute value of
243 .\"O is greater than 1,
246 .\"O is positive infinity,
247 .\"O the result is positive infinity.
249 ¤ÎÀäÂÐÃͤ¬ 1 ¤è¤êÂ礤¯¡¢
251 ¤¬Àµ¤Î̵¸ÂÂç¤Î¾ì¹ç¡¢ÊÖ¤êÃͤÏÀµ¤Î̵¸ÂÂç¤È¤Ê¤ë¡£
255 .\"O is negative infinity,
258 .\"O is an odd integer less than 0,
259 .\"O the result is \-0.
263 ¤¬ 0 ¤è¤ê¾®¤µ¤¤´ñ¿ô¤Î¾ì¹ç¡¢ÊÖ¤êÃÍ¤Ï \-0 ¤È¤Ê¤ë¡£
267 .\"O is negative infinity,
270 .\"O less than 0 and not an odd integer,
271 .\"O the result is +0.
275 ¤¬ 0 ¤è¤ê¾®¤µ¤¯´ñ¿ô¤Ç¤Ê¤¤¾ì¹ç¡¢ÊÖ¤êÃÍ¤Ï +0 ¤È¤Ê¤ë¡£
279 .\"O is negative infinity,
282 .\"O is an odd integer greater than 0,
283 .\"O the result is negative infinity.
287 ¤¬ 0 ¤è¤êÂ礤¤´ñ¿ô¤Î¾ì¹ç¡¢ÊÖ¤êÃͤÏÉé¤Î̵¸ÂÂç¤È¤Ê¤ë¡£
291 .\"O is negative infinity,
294 .\"O greater than 0 and not an odd integer,
295 .\"O the result is positive infinity.
299 ¤¬ 0 ¤è¤êÂ礤¯´ñ¿ô¤Ç¤Ê¤¤¾ì¹ç¡¢ÊÖ¤êÃͤÏÀµ¤Î̵¸ÂÂç¤È¤Ê¤ë¡£
303 .\"O is positive infinity,
307 .\"O the result is +0.
311 ¤¬ 0 ̤Ëþ¤Î¾ì¹ç¡¢ÊÖ¤êÃÍ¤Ï +0 ¤È¤Ê¤ë¡£
315 .\"O is positive infinity,
319 .\"O the result is positive infinity.
323 ¤¬ 0 ¤è¤êÂ礤¤¾ì¹ç¡¢ÊÖ¤êÃͤÏÀµ¤Î̵¸ÂÂç¤È¤Ê¤ë¡£
330 .\"O is an odd integer less than 0,
331 .\"O a pole error occurs and
337 .\"O with the same sign as
342 ¤¬ 0 ¤è¤ê¾®¤µ¤¤´ñ¿ô¤Î¾ì¹ç¡¢
343 ¶Ë¥¨¥é¡¼ (pole error) ¤¬È¯À¸¤·¡¢ÊÖ¤êÃͤÏ
349 ¤ÈƱ¤¸Éä¹æ¤¬ÉÕÍ¿¤µ¤ì¤ë¡£
356 .\"O is less than 0 and not an odd integer,
357 .\"O a pole error occurs and
361 ¤¬ 0 ¤è¤ê¾®¤µ¤¯´ñ¿ô¤Ç¤Ê¤¤¾ì¹ç¡¢
363 .\" The pole error is generated at least as far back as glibc 2.4
364 .\"O .RB + HUGE_VAL ,
365 .\"O .RB + HUGE_VALF ,
367 .\"O .RB + HUGE_VALL ,
376 .\" FIXME . review status of this error
377 .\" longstanding bug report for glibc:
378 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
379 .\" For negative x, and -large and +large y, glibc 2.8 gives incorrect
381 .\" pow(-0.5,-DBL_MAX)=nan
382 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
383 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
385 .\" pow(-1.5,-DBL_MAX)=nan
386 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
387 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
389 .\" pow(-0.5,DBL_MAX)=nan
390 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
391 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
393 .\" pow(-1.5,DBL_MAX)=nan
394 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
395 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
397 .\"O .BR math_error (7)
398 .\"O for information on how to determine whether an error has occurred
399 .\"O when calling these functions.
400 ¤³¤ì¤é¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤¿ºÝ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿¤«¤ÎȽÄêÊýË¡¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤Ï
404 .\"O The following errors can occur:
405 °Ê²¼¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë²ÄǽÀ¤¬¤¢¤ë¡£
407 .\"O Domain error: \fIx\fP is negative, and \fIy\fP is a finite noninteger
408 Îΰ襨¥é¡¼: \fIx\fP ¤¬Éé¤Ç¡¢\fIy\fP ¤¬À°¿ô¤Ç¤Ê¤¤Í¸ÂÃÍ
412 .\"O An invalid floating-point exception
413 .\"O .RB ( FE_INVALID )
419 ÉÔÀµ (invalid) ÉâÆ°¾®¿ôÅÀÎã³°
423 .\"O Pole error: \fIx\fP is zero, and \fIy\fP is negative
424 ¶Ë¥¨¥é¡¼: \fIx\fP ¤¬¥¼¥í¤Ç¡¢\fIy\fP ¤¬Éé
433 .\"O A divide-by-zero floating-point exception
434 .\"O .RB ( FE_DIVBYZERO )
436 0 ¤Ë¤è¤ë½ü»» (divide-by-zero) ÉâÆ°¾®¿ôÅÀÎã³°
440 .\"O Range error: the result overflows
441 ÈÏ°Ï¥¨¥é¡¼: ·ë²Ì¤¬¥ª¡¼¥Ð¡¼¥Õ¥í¡¼
445 .\"O An overflow floating-point exception
446 .\"O .RB ( FE_OVERFLOW )
452 ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼ÉâÆ°¾®¿ôÅÀÎã³°
456 .\"O Range error: the result underflows
457 ÈÏ°Ï¥¨¥é¡¼: ·ë²Ì¤¬¥¢¥ó¥À¡¼¥Õ¥í¡¼
461 .\"O An underflow floating-point exception
462 .\"O .RB ( FE_UNDERFLOW )
468 ¥¢¥ó¥À¡¼¥Õ¥í¡¼ÉâÆ°¾®¿ôÅÀÎã³°
471 .\"O .SH "CONFORMING TO"
474 .\"O The variant returning
476 .\"O also conforms to
477 .\"O SVr4, 4.3BSD, C89.
479 ÈǤδؿô¤Ï SVr4, 4.3BSD, C89 ¤Ë¤â½àµò¤·¤Æ¤¤¤ë¡£
482 .\"O In glibc 2.9 and earlier,
484 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6776
485 .\"O when a pole error occurs,
489 .\"O instead of the POSIX-mandated
491 .\"O Since version 2.10,
492 .\" or possibly 2.9, I haven't found the source code change
493 .\" and I don't have a 2.9 system to test
494 .\"O glibc does the right thing.
495 glibc 2.9 ¤È¤½¤ì°ÊÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¡¢
496 ¶Ë¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¡¢POSIX ¤ÇÍ׵ᤵ¤ì¤Æ¤¤¤ë
503 ¥Ð¡¼¥¸¥ç¥ó 2.10 °Ê¹ß¤Î glibc ¤Ç¤Ï¡¢Àµ¤·¤¤Æ°ºî¤ò¤¹¤ë¡£
508 .\"O then large negative or positive
510 .\"O values yield a NaN as the function result, with
515 .\"O .RB ( FE_INVALID )
516 .\"O floating-point exception.
518 ¤¬Éé¤Î¾ì¹ç¡¢Â礤ÊÀµÉé¤ÎÃͤÎ
520 ¤¬Í¿¤¨¤é¤ì¤ë¤È¡¢´Ø¿ô¤Î·ë²Ì¤¬ NaN ¤È¤Ê¤ê¡¢
528 .\"O For example, with
530 .\"O one sees this behavior when the absolute value of
532 .\"O is greater than about 9.223373e18.
537 ¤ÎÀäÂÐÃͤ¬Ìó 9.223373e18 ¤è¤êÂ礤¤¾ì¹ç¤Ë¤³¤Î¾õ¶·¤È¤Ê¤ë¡£
538 .\" see bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
539 .\" and http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
541 .\"O In version 2.3.2 and earlier,
542 glibc ¥Ð¡¼¥¸¥ç¥ó 2.3.2 °ÊÁ°¤Ç¤Ï¡¢
543 .\" FIXME . Actually, 2.3.2 is the earliest test result I have; so yet
544 .\" to confirm if this error occurs only in 2.3.2.
545 .\"O when an overflow or underflow error occurs, glibc's
547 .\"O generates a bogus invalid floating-point exception
548 .\"O .RB ( FE_INVALID )
549 .\"O in addition to the overflow or underflow exception.
550 ¥¢¥ó¥À¡¼¥Õ¥í¡¼¤ä¥¢¥ó¥À¡¼¥Õ¥í¡¼¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¾ì¹ç¡¢
553 ¤Ï¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼Îã³°¤ä¥¢¥ó¥À¡¼¥Õ¥í¡¼Îã³°¤ò¾å¤²¤ë¤À¤±¤Ç¤Ê¤¯¡¢