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)
33 .TH POW 3 2010-09-12 "" "Linux Programmer's Manual"
35 pow, powf, powl \- power functions
40 .BI "double pow(double " x ", double " y );
42 .BI "float powf(float " x ", float " y );
44 .BI "long double powl(long double " x ", long double " y );
50 Feature Test Macro Requirements for glibc (see
51 .BR feature_test_macros (7)):
58 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
59 _POSIX_C_SOURCE\ >=\ 200112L;
68 function returns the value of \fIx\fP raised to the
71 On success, these functions return the value of
78 is a finite value less than 0, and
80 is a finite noninteger, a domain error occurs,
81 .\" The domain error is generated at least as far back as glibc 2.4
82 and a NaN is returned.
84 If the result overflows,
86 .\" The range error is generated at least as far back as glibc 2.4
87 and the functions return
92 respectively, with the mathematically correct sign.
94 If result underflows, and is not representable,
97 .\" POSIX.1 does not specify the sign of the zero,
98 .\" but http://sources.redhat.com/bugzilla/show_bug.cgi?id=2678
99 .\" points out that the zero has the wrong sign in some cases.
101 Except as specified below, if
105 is a NaN, the result is a NaN.
109 is +1, the result is 1.0 (even if
115 is 0, the result is 1.0 (even if
124 is an odd integer greater than 0,
125 the result is +0 (\-0).
132 greater than 0 and not an odd integer,
140 is positive infinity or negative infinity,
143 If the absolute value of
148 is negative infinity,
149 the result is positive infinity.
151 If the absolute value of
156 is negative infinity,
159 If the absolute value of
164 is positive infinity,
167 If the absolute value of
172 is positive infinity,
173 the result is positive infinity.
177 is negative infinity,
180 is an odd integer less than 0,
185 is negative infinity,
188 less than 0 and not an odd integer,
193 is negative infinity,
196 is an odd integer greater than 0,
197 the result is negative infinity.
201 is negative infinity,
204 greater than 0 and not an odd integer,
205 the result is positive infinity.
209 is positive infinity,
217 is positive infinity,
221 the result is positive infinity.
228 is an odd integer less than 0,
229 a pole error occurs and
235 with the same sign as
243 is less than 0 and not an odd integer,
244 a pole error occurs and
245 .\" The pole error is generated at least as far back as glibc 2.4
252 .\" FIXME . review status of this error
253 .\" longstanding bug report for glibc:
254 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
255 .\" For negative x, and -large and +large y, glibc 2.8 gives incorrect
257 .\" pow(-0.5,-DBL_MAX)=nan
258 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
259 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
261 .\" pow(-1.5,-DBL_MAX)=nan
262 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
263 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
265 .\" pow(-0.5,DBL_MAX)=nan
266 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
267 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
269 .\" pow(-1.5,DBL_MAX)=nan
270 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
271 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
274 for information on how to determine whether an error has occurred
275 when calling these functions.
277 The following errors can occur:
279 Domain error: \fIx\fP is negative, and \fIy\fP is a finite noninteger
283 An invalid floating-point exception
287 Pole error: \fIx\fP is zero, and \fIy\fP is negative
292 A divide-by-zero floating-point exception
296 Range error: the result overflows
300 An overflow floating-point exception
304 Range error: the result underflows
308 An underflow floating-point exception
313 The variant returning
318 In glibc 2.9 and earlier,
320 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6776
321 when a pole error occurs,
325 instead of the POSIX-mandated
328 .\" or possibly 2.9, I haven't found the source code change
329 .\" and I don't have a 2.9 system to test
330 glibc does the right thing.
335 then large negative or positive
337 values yield a NaN as the function result, with
343 floating-point exception.
346 one sees this behavior when the absolute value of
348 is greater than about 9.223373e18.
349 .\" see bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
350 .\" and http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
352 In version 2.3.2 and earlier,
353 .\" FIXME . Actually, 2.3.2 is the earliest test result I have; so yet
354 .\" to confirm if this error occurs only in 2.3.2.
355 when an overflow or underflow error occurs, glibc's
357 generates a bogus invalid floating-point exception
359 in addition to the overflow or underflow exception.