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 .\" %%%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.
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.
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
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
27 .\" References consulted:
28 .\" Linux libc source code
29 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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 .TH POW 3 2010-09-12 "" "Linux Programmer's Manual"
37 pow, powf, powl \- power functions
42 .BI "double pow(double " x ", double " y );
44 .BI "float powf(float " x ", float " y );
46 .BI "long double powl(long double " x ", long double " y );
52 Feature Test Macro Requirements for glibc (see
53 .BR feature_test_macros (7)):
60 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
61 _POSIX_C_SOURCE\ >=\ 200112L;
70 function returns the value of \fIx\fP raised to the
73 On success, these functions return the value of
80 is a finite value less than 0, and
82 is a finite noninteger, a domain error occurs,
83 .\" The domain error is generated at least as far back as glibc 2.4
84 and a NaN is returned.
86 If the result overflows,
88 .\" The range error is generated at least as far back as glibc 2.4
89 and the functions return
94 respectively, with the mathematically correct sign.
96 If result underflows, and is not representable,
99 .\" POSIX.1 does not specify the sign of the zero,
100 .\" but http://sources.redhat.com/bugzilla/show_bug.cgi?id=2678
101 .\" points out that the zero has the wrong sign in some cases.
103 Except as specified below, if
107 is a NaN, the result is a NaN.
111 is +1, the result is 1.0 (even if
117 is 0, the result is 1.0 (even if
126 is an odd integer greater than 0,
127 the result is +0 (\-0).
134 greater than 0 and not an odd integer,
142 is positive infinity or negative infinity,
145 If the absolute value of
150 is negative infinity,
151 the result is positive infinity.
153 If the absolute value of
158 is negative infinity,
161 If the absolute value of
166 is positive infinity,
169 If the absolute value of
174 is positive infinity,
175 the result is positive infinity.
179 is negative infinity,
182 is an odd integer less than 0,
187 is negative infinity,
190 less than 0 and not an odd integer,
195 is negative infinity,
198 is an odd integer greater than 0,
199 the result is negative infinity.
203 is negative infinity,
206 greater than 0 and not an odd integer,
207 the result is positive infinity.
211 is positive infinity,
219 is positive infinity,
223 the result is positive infinity.
230 is an odd integer less than 0,
231 a pole error occurs and
237 with the same sign as
245 is less than 0 and not an odd integer,
246 a pole error occurs and
247 .\" The pole error is generated at least as far back as glibc 2.4
254 .\" FIXME . review status of this error
255 .\" longstanding bug report for glibc:
256 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
257 .\" For negative x, and -large and +large y, glibc 2.8 gives incorrect
259 .\" pow(-0.5,-DBL_MAX)=nan
260 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
261 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
263 .\" pow(-1.5,-DBL_MAX)=nan
264 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
265 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
267 .\" pow(-0.5,DBL_MAX)=nan
268 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
269 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
271 .\" pow(-1.5,DBL_MAX)=nan
272 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
273 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
276 for information on how to determine whether an error has occurred
277 when calling these functions.
279 The following errors can occur:
281 Domain error: \fIx\fP is negative, and \fIy\fP is a finite noninteger
285 An invalid floating-point exception
289 Pole error: \fIx\fP is zero, and \fIy\fP is negative
294 A divide-by-zero floating-point exception
298 Range error: the result overflows
302 An overflow floating-point exception
306 Range error: the result underflows
310 An underflow floating-point exception
315 The variant returning
320 In glibc 2.9 and earlier,
322 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6776
323 when a pole error occurs,
327 instead of the POSIX-mandated
330 .\" or possibly 2.9, I haven't found the source code change
331 .\" and I don't have a 2.9 system to test
332 glibc does the right thing.
337 then large negative or positive
339 values yield a NaN as the function result, with
345 floating-point exception.
348 one sees this behavior when the absolute value of
350 is greater than about 9.223373e18.
351 .\" see bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
352 .\" and http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
354 In version 2.3.2 and earlier,
355 .\" FIXME . Actually, 2.3.2 is the earliest test result I have; so yet
356 .\" to confirm if this error occurs only in 2.3.2.
357 when an overflow or underflow error occurs, glibc's
359 generates a bogus invalid floating-point exception
361 in addition to the overflow or underflow exception.