import less(1)
[unleashed/tickless.git] / share / man / man3m / pow.3m
blob78f49df142cdd08ce4a857a83a6e43b17b0f7dfe
1 '\" te
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"
13 .SH NAME
14 pow, powf, powl \- power function
15 .SH SYNOPSIS
16 .LP
17 .nf
18 c99 [ \fIflag\fR... ] \fIfile\fR... \fB-lm\fR [ \fIlibrary\fR... ]
19 #include <math.h>
21 \fBdouble\fR \fBpow\fR(\fBdouble\fR x, \fBdouble\fR y);
22 .fi
24 .LP
25 .nf
26 \fBfloat\fR \fBpowf\fR(\fBfloat\fR x, \fBfloat\fR y);
27 .fi
29 .LP
30 .nf
31 \fBlong double\fR \fBpowl\fR(\fBlong double\fR x, \fBlong double\fR y);
32 .fi
34 .LP
35 .nf
36 cc [ \fIflag\fR... ] \fIfile\fR... \fB-lm\fR [ \fIlibrary\fR... ]
37 #include <math.h>
39 \fBdouble\fR \fBpow\fR(\fBdouble\fR x, \fBdouble\fR y);
40 .fi
42 .LP
43 .nf
44 \fBfloat\fR \fBpowf\fR(\fBfloat\fR x, \fBfloat\fR y);
45 .fi
47 .LP
48 .nf
49 \fBlong double\fR \fBpowl\fR(\fBlong double\fR x, \fBlong double\fR y);
50 .fi
52 .SH DESCRIPTION
53 .sp
54 .LP
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.
57 .SH RETURN VALUES
58 .sp
59 .LP
60 Upon successful completion, these functions return the value of \fIx\fR raised
61 to the power \fIy\fR.
62 .sp
63 .LP
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.
67 .sp
68 .LP
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.
72 .sp
73 .LP
74 If \fIx\fR or \fIy\fR is a NaN, a NaN is returned unless:
75 .RS +4
76 .TP
77 .ie t \(bu
78 .el o
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.
82 .RE
83 .RS +4
84 .TP
85 .ie t \(bu
86 .el o
87 For any value of \fIx\fR (including NaN), if \fIy\fR is +0, 1.0 is returned.
88 .RE
89 .sp
90 .LP
91 For any odd integer value of \fIy\fR > 0, if \fIx\fR is \(+-0, \(+-0 is
92 returned.
93 .sp
94 .LP
95 For \fIy\fR > 0 and not an odd integer, if \fIx\fR is \(+-0, +0 is returned.
96 .sp
97 .LP
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
126 returned.
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.
147 .SH ERRORS
150 These functions will fail if:
152 .ne 2
155 \fBDomain Error\fR
157 .RS 16n
158 .rt  
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.
169 .ne 2
172 \fBPole Error\fR
174 .RS 16n
175 .rt  
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.
183 .ne 2
186 \fBRange Error\fR
188 .RS 16n
189 .rt  
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.
199 .SH USAGE
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.
213 .SH ATTRIBUTES
216 See \fBattributes\fR(5) for descriptions of the following attributes:
221 tab(\a) box;
222 cw(2.75i) |cw(2.75i) 
223 lw(2.75i) |lw(2.75i) 
225 ATTRIBUTE TYPE\aATTRIBUTE VALUE
227 Interface Stability\aStandard
229 MT-Level\aMT-Safe
232 .SH SEE ALSO
235 \fBexp\fR(3M), \fBfeclearexcept\fR(3M), \fBfetestexcept\fR(3M),
236 \fBisnan\fR(3M), \fBmath.h\fR(3HEAD), \fBmatherr\fR(3M), \fBattributes\fR(5),
237 \fBstandards\fR(5)
238 .SH NOTES
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.