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
76 On success, these functions return the value of
83 is a finite value less than 0, and
85 is a finite noninteger, a domain error occurs,
86 .\" The domain error is generated at least as far back as glibc 2.4
87 and a NaN is returned.
89 If the result overflows,
91 .\" The range error is generated at least as far back as glibc 2.4
92 and the functions return
97 respectively, with the mathematically correct sign.
99 If result underflows, and is not representable,
100 a range error occurs,
102 .\" POSIX.1 does not specify the sign of the zero,
103 .\" but http://sources.redhat.com/bugzilla/show_bug.cgi?id=2678
104 .\" points out that the zero has the wrong sign in some cases.
106 Except as specified below, if
110 is a NaN, the result is a NaN.
114 is +1, the result is 1.0 (even if
120 is 0, the result is 1.0 (even if
129 is an odd integer greater than 0,
130 the result is +0 (\-0).
137 greater than 0 and not an odd integer,
145 is positive infinity or negative infinity,
148 If the absolute value of
153 is negative infinity,
154 the result is positive infinity.
156 If the absolute value of
161 is negative infinity,
164 If the absolute value of
169 is positive infinity,
172 If the absolute value of
177 is positive infinity,
178 the result is positive infinity.
182 is negative infinity,
185 is an odd integer less than 0,
190 is negative infinity,
193 less than 0 and not an odd integer,
198 is negative infinity,
201 is an odd integer greater than 0,
202 the result is negative infinity.
206 is negative infinity,
209 greater than 0 and not an odd integer,
210 the result is positive infinity.
214 is positive infinity,
222 is positive infinity,
226 the result is positive infinity.
233 is an odd integer less than 0,
234 a pole error occurs and
240 with the same sign as
248 is less than 0 and not an odd integer,
249 a pole error occurs and
250 .\" The pole error is generated at least as far back as glibc 2.4
257 .\" FIXME . review status of this error
258 .\" longstanding bug report for glibc:
259 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
260 .\" For negative x, and -large and +large y, glibc 2.8 gives incorrect
262 .\" pow(-0.5,-DBL_MAX)=nan
263 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
264 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
266 .\" pow(-1.5,-DBL_MAX)=nan
267 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
268 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
270 .\" pow(-0.5,DBL_MAX)=nan
271 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
272 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
274 .\" pow(-1.5,DBL_MAX)=nan
275 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
276 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
279 for information on how to determine whether an error has occurred
280 when calling these functions.
282 The following errors can occur:
284 Domain error: \fIx\fP is negative, and \fIy\fP is a finite noninteger
288 An invalid floating-point exception
292 Pole error: \fIx\fP is zero, and \fIy\fP is negative
297 A divide-by-zero floating-point exception
301 Range error: the result overflows
305 An overflow floating-point exception
309 Range error: the result underflows
313 An underflow floating-point exception
318 The variant returning
323 In glibc 2.9 and earlier,
325 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6776
326 when a pole error occurs,
330 instead of the POSIX-mandated
333 .\" or possibly 2.9, I haven't found the source code change
334 .\" and I don't have a 2.9 system to test
335 glibc does the right thing.
340 then large negative or positive
342 values yield a NaN as the function result, with
348 floating-point exception.
351 one sees this behavior when the absolute value of
353 is greater than about 9.223373e18.
354 .\" see bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
355 .\" and http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
357 In version 2.3.2 and earlier,
358 .\" FIXME . Actually, 2.3.2 is the earliest test result I have; so yet
359 .\" to confirm if this error occurs only in 2.3.2.
360 when an overflow or underflow error occurs, glibc's
362 generates a bogus invalid floating-point exception
364 in addition to the overflow or underflow exception.