.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk .\" .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu) .\" Modified 1995-08-14 by Arnt Gulbrandsen .\" Modified 2002-07-27 by Walter Harms .\" (walter.harms@informatik.uni-oldenburg.de) .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2003, 2008 Akihiro MOTOKI .\" all rights reserved. .\" Translated Mon Sep 7 23:27:52 JST 2003 .\" by Akihiro MOTOKI .\" Updated 2008-09-18, Akihiro MOTOKI .\" .TH POW 3 2014\-12\-31 "" "Linux Programmer's Manual" .SH 名前 pow, powf, powl \- 累乗関数 .SH 書式 .nf \fB#include \fP .sp \fBdouble pow(double \fP\fIx\fP\fB, double \fP\fIy\fP\fB);\fP .br \fBfloat powf(float \fP\fIx\fP\fB, float \fP\fIy\fP\fB);\fP .br \fBlong double powl(long double \fP\fIx\fP\fB, long double \fP\fIy\fP\fB);\fP .fi .sp \fI\-lm\fP でリンクする。 .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp .ad l \fBpowf\fP(), \fBpowl\fP(): .RS 4 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L; .br or \fIcc\ \-std=c99\fP .RE .ad .SH 説明 \fBpow\fP() 関数は \fIx\fP の \fIy\fP 乗の値を返す。 .SH 返り値 成功すると、これらの関数は \fIx\fP の \fIy\fP 乗の値を返す。 .\" The domain error is generated at least as far back as glibc 2.4 \fIx\fP が 0 未満の有限値で \fIy\fP が整数でない有限値の場合、領域エラー (domain error) が発生し、 NaN が返される。 .\" The range error is generated at least as far back as glibc 2.4 結果がオーバーフローする場合、 範囲エラー (range error) が発生し、 各関数はそれぞれ \fBHUGE_VAL\fP, \fBHUGE_VALF\fP, \fBHUGE_VALL\fP を返す。返り値には数学的に正しい符号が付与される。 .\" POSIX.1 does not specify the sign of the zero, .\" but http://sources.redhat.com/bugzilla/show_bug.cgi?id=2678 .\" points out that the zero has the wrong sign in some cases. 結果がアンダーフローし、その値が表現可能でない場合、 範囲エラーが発生し、 0.0 が返される。 以下で規定されていない場合で、 \fIx\fP か \fIy\fP が NaN の場合、返り値は NaN となる。 \fIx\fP が +1 の場合、 (\fIy\fP が NaN であったとしても) 返り値は 1.0 となる。 \fIy\fP が 0 の場合、 (\fIx\fP が NaN であったとしても) 返り値は 1.0 となる。 \fIx\fP が +0 (\-0) で \fIy\fP が 0 より大きな奇数の場合、返り値は +0 (\-0) となる。 \fIx\fP が 0 で、 \fIy\fP が 0 より大きく奇数でない場合、返り値は +0 となる。 \fIx\fP が \-1 で、 \fIy\fP が正の無限大か負の無限大の場合、返り値は 1.0 となる。 \fIx\fP の絶対値が 1 未満で、 \fIy\fP が負の無限大の場合、返り値は正の無限大となる。 \fIx\fP 絶対値が 1 より大きく、 \fIy\fP が負の無限大の場合、返り値は +0 となる。 \fIx\fP の絶対値が 1 未満で、 \fIy\fP が正の無限大の場合、返り値は +0 となる。 \fIx\fP の絶対値が 1 より大きく、 \fIy\fP が正の無限大の場合、返り値は正の無限大となる。 \fIx\fP が負の無限大で、 \fIy\fP が 0 より小さい奇数の場合、返り値は \-0 となる。 \fIx\fP が負の無限大で、 \fIy\fP が 0 より小さく奇数でない場合、返り値は +0 となる。 \fIx\fP が負の無限大で、 \fIy\fP が 0 より大きい奇数の場合、返り値は負の無限大となる。 \fIx\fP が負の無限大で、 \fIy\fP が 0 より大きく奇数でない場合、返り値は正の無限大となる。 \fIx\fP が正の無限大で、 \fIy\fP が 0 未満の場合、返り値は +0 となる。 \fIx\fP が正の無限大で、 \fIy\fP が 0 より大きい場合、返り値は正の無限大となる。 \fIx\fP が +0 か \-0 で、 \fIy\fP が 0 より小さい奇数の場合、 極エラー (pole error) が発生し、返り値は \fBHUGE_VAL\fP, \fBHUGE_VALF\fP, \fBHUGE_VALL\fP となる。 \fIx\fP と同じ符号が付与される。 .\" The pole error is generated at least as far back as glibc 2.4 \fIx\fP が +0 か \-0 で、 \fIy\fP が 0 より小さく奇数でない場合、 極エラーが発生し、 返り値は \fB+\fPHUGE_VAL\fB,\fP \fB+\fPHUGE_VALF\fB,\fP \fB+\fPHUGE_VALL となる。 .SH エラー .\" FIXME . review status of this error .\" longstanding bug report for glibc: .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=369 .\" For negative x, and -large and +large y, glibc 2.8 gives incorrect .\" results .\" pow(-0.5,-DBL_MAX)=nan .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result; .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF) .\" .\" pow(-1.5,-DBL_MAX)=nan .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result; .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0) .\" .\" pow(-0.5,DBL_MAX)=nan .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result; .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0) .\" .\" pow(-1.5,DBL_MAX)=nan .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result; .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF) これらの関数を呼び出した際にエラーが発生したかの判定方法についての情報は \fBmath_error\fP(7) を参照のこと。 .PP 以下のエラーが発生する可能性がある。 .TP 領域エラー: \fIx\fP が負で、\fIy\fP が整数でない有限値 \fIerrno\fP に \fBEDOM\fP が設定される。 不正 (invalid) 浮動小数点例外 (\fBFE_INVALID\fP) が上がる。 .TP 極エラー: \fIx\fP がゼロで、\fIy\fP が負 \fIerrno\fP に \fBERANGE\fP が設定される (「バグ」の節も参照)。 0 による除算 (divide\-by\-zero) 浮動小数点例外 (\fBFE_DIVBYZERO\fP) が上がる。 .TP 範囲エラー: 結果がオーバーフロー \fIerrno\fP に \fBERANGE\fP が設定される。 オーバーフロー浮動小数点例外 (\fBFE_OVERFLOW\fP) が上がる。 .TP 範囲エラー: 結果がアンダーフロー \fIerrno\fP に \fBERANGE\fP が設定される。 アンダーフロー浮動小数点例外 (\fBFE_UNDERFLOW\fP) が上がる。 .SH 準拠 C99, POSIX.1\-2001. \fIdouble\fP 版の関数は SVr4, 4.3BSD, C89 にも準拠している。 .SH バグ .\" .\" https://sourceware.org/bugzilla/show_bug.cgi?id=13932 64 ビットでは、 \fBpow\fP は、特定の (ごく稀な) 入力に対して、その直近の似たような数字の場合と比べて 10000 倍以上遅くなることがある。 これは \fBpow\fP() でのみ起こることであり、 \fBpowf\fP() や \fBpowl\fP() では起こらない。 .\" .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6776 .\" or possibly 2.9, I haven't found the source code change .\" and I don't have a 2.9 system to test glibc 2.9 とそれ以前のバージョンでは、 極エラーが発生した場合、POSIX で要求されている \fBERANGE\fP ではなく \fBEDOM\fP が \fIerrno\fP に設定される。 バージョン 2.10 以降の glibc では、正しい動作をする。 .\" see bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866 .\" and http://sources.redhat.com/bugzilla/show_bug.cgi?id=369 \fIx\fP が負の場合、大きな正負の値の \fIy\fP が与えられると、関数の結果が NaN となり、 \fIerrno\fP に \fBEDOM\fP が設定され、 不正浮動小数点例外 (\fBFE_INVALID\fP) が発生する。 例えば、 \fBpow\fP() では、 \fIy\fP の絶対値が約 9.223373e18 より大きい場合にこの状況となる。 .\" FIXME . Actually, 2.3.2 is the earliest test result I have; so yet .\" to confirm if this error occurs only in 2.3.2. glibc バージョン 2.3.2 以前では、 アンダーフローやアンダーフローのエラーが発生する場合、 glibc の \fBpow\fP() は、オーバーフロー例外やアンダーフロー例外を上げるだけでなく、 不正浮動小数点例外 (\fBFE_INVALID\fP) を間違って発生する。 .SH 関連項目 \fBcbrt\fP(3), \fBcpow\fP(3), \fBsqrt\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。