2 .\" Copyright (c) 2001, the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All Rights Reserved.
3 .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
4 .\" Portions Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\" This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH pow 3M "12 Jul 2006" "SunOS 5.11" "Mathematical Library Functions"
14 pow, powf, powl \- power function
18 c99 [ \fIflag\fR... ] \fIfile\fR... \fB-lm\fR [ \fIlibrary\fR... ]
21 \fBdouble\fR \fBpow\fR(\fBdouble\fR x, \fBdouble\fR y);
26 \fBfloat\fR \fBpowf\fR(\fBfloat\fR x, \fBfloat\fR y);
31 \fBlong double\fR \fBpowl\fR(\fBlong double\fR x, \fBlong double\fR y);
36 cc [ \fIflag\fR... ] \fIfile\fR... \fB-lm\fR [ \fIlibrary\fR... ]
39 \fBdouble\fR \fBpow\fR(\fBdouble\fR x, \fBdouble\fR y);
44 \fBfloat\fR \fBpowf\fR(\fBfloat\fR x, \fBfloat\fR y);
49 \fBlong double\fR \fBpowl\fR(\fBlong double\fR x, \fBlong double\fR y);
55 These functions compute the value of \fIx\fR raised to the power \fIy,\fR
56 \fIx\fR^y>. If \fIx\fR is negative, \fIy\fR must be an integer value.
60 Upon successful completion, these functions return the value of \fIx\fR raised
64 For finite values of \fIx\fR < 0, and finite non-integer values of \fIy\fR, a
65 domain error occurs and either a NaN (if representable), or an
66 implementation-defined value is returned.
69 If the correct value would cause overflow, a range error occurs and
70 \fBpow()\fR, \fBpowf()\fR, and \fBpowl()\fR return \fBHUGE_VAL\fR,
71 \fBHUGE_VALF\fR, and \fBHUGE_VALL\fR, respectively.
74 If \fIx\fR or \fIy\fR is a NaN, a NaN is returned unless:
79 If \fIx\fR is +1 and \fIy\fR is NaN and the application was compiled with the
80 \fBc99\fR compiler driver and is therefore SUSv3-conforming (see
81 \fBstandards\fR(5)), 1.0 is returned.
87 For any value of \fIx\fR (including NaN), if \fIy\fR is +0, 1.0 is returned.
91 For any odd integer value of \fIy\fR > 0, if \fIx\fR is \(+-0, \(+-0 is
95 For \fIy\fR > 0 and not an odd integer, if \fIx\fR is \(+-0, +0 is returned.
98 If \fIx\fR is \(+-1 and \fIy\fR is \(+-Inf, and the application was compiled
99 with the \fBcc\fR compiler driver, NaN is returned. If, however, the
100 application was compiled with the \fBc99\fR compiler driver and is therefore
101 SUSv3-conforming (see\fBstandards\fR(5)), 1.0 is returned.
104 For |\fIx\fR| < 1, if \fIy\fR is \(miInf, +Inf is returned.
107 For |\fIx\fR| > 1, if \fIy\fR is \(miInf, +0 is returned.
110 For |\fIx\fR| < 1, if \fIy\fR is +Inf, +0 is returned.
113 For |\fIx\fR| > 1, if \fIy\fR is +Inf, +Inf is returned.
116 For \fIy\fR an odd integer < 0, if \fIx\fR is \(miInf, \(mi0 is returned.
119 For \fIy\fR < 0 and not an odd integer, if \fIx\fR is \(miInf, +0 is returned.
122 For \fIy\fR an odd integer > 0, if \fIx\fR is \(miInf, \(miInf is returned.
125 For \fIy\fR > 0 and not an odd integer, if \fIx\fR is \(miInf, +Inf is
129 For \fIy\fR < 0, if \fIx\fR is +Inf, +0 is returned.
132 For \fIy\fR > 0, if \fIx\fR is +Inf, +Inf is returned.
135 For \fIy\fR an odd integer < 0, if \fIx\fR is \(+-0, a pole error occurs and
136 \(+-\fBHUGE_VAL\fR, \(+-\fBHUGE_VALF\fR, and \(+-\fBHUGE_VALL\fR are returned
137 for \fBpow()\fR, \fBpowf()\fR, and \fBpowl()\fR, respectively.
140 For \fIy\fR < 0 and not an odd integer, if \fIx\fR is \(+-0, a pole error
141 occurs and \fBHUGE_VAL\fR, \fBHUGE_VALF\fR, and \fBHUGE_VALL\fR are returned
142 for \fBpow()\fR, \fBpowf()\fR, and \fBpowl()\fR, respectively.
145 For exceptional cases, \fBmatherr\fR(3M) tabulates the values to be returned by
146 \fBpow()\fR as specified by SVID3 and XPG3.
150 These functions will fail if:
159 The value of \fIx\fR is negative and \fIy\fR is a finite non-integer.
161 If the integer expression (\fBmath_errhandling\fR & \fBMATH_ERREXCEPT\fR) is
162 non-zero, the invalid floating-point exception is raised.
164 The \fBpow()\fR function sets \fBerrno\fR to \fBEDOM\fR if the value of \fIx\fR
165 is negative and \fIy\fR is non-integral.
176 The value of \fIx\fR is 0 and \fIy\fR is negative.
178 If the integer expression (\fBmath_errhandling\fR & \fBMATH_ERREXCEPT\fR) is
179 non-zero, the divide-by-zero floating-point exception is raised.
190 The result overflows.
192 If the integer expression (\fBmath_errhandling\fR & \fBMATH_ERREXCEPT\fR) is
193 non-zero, the overflow floating-point exception is raised.
195 The \fBpow()\fR function sets \fBerrno\fR to \fBEDOM\fR if the value to be
196 returned would cause overflow.
202 An application wanting to check for exceptions should call
203 \fBfeclearexcept\fR(\fBFE_ALL_EXCEPT\fR) before calling these functions. On
204 return, if \fBfetestexcept\fR(\fBFE_INVALID\fR | \fBFE_DIVBYZERO\fR |
205 \fBFE_OVERFLOW\fR | \fBFE_UNDERFLOW\fR) is non-zero, an exception has been
206 raised. An application should either examine the return value or check the
207 floating point exception flags to detect exceptions.
210 An application can also set \fBerrno\fR to 0 before calling \fBpow()\fR. On
211 return, if \fBerrno\fR is non-zero, an error has occurred. The \fBpowf()\fR and
212 \fBpowl()\fR functions do not set \fBerrno\fR.
216 See \fBattributes\fR(5) for descriptions of the following attributes:
225 ATTRIBUTE TYPE
\aATTRIBUTE VALUE
227 Interface Stability
\aStandard
235 \fBexp\fR(3M), \fBfeclearexcept\fR(3M), \fBfetestexcept\fR(3M),
236 \fBisnan\fR(3M), \fBmath.h\fR(3HEAD), \fBmatherr\fR(3M), \fBattributes\fR(5),
241 Prior to Solaris 2.6, there was a conflict between the \fBpow()\fR function in
242 this library and the \fBpow()\fR function in the \fBlibmp\fR library. This
243 conflict was resolved by prepending \fBmp_\fR to all functions in the
244 \fBlibmp\fR library. See \fBmp\fR(3MP) for more information.