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 2008-08-10 "" "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)):
57 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
63 function returns the value of \fIx\fP raised to the
66 On success, these functions return the value of
73 is a finite value less than 0, and
75 is a finite noninteger, a domain error occurs,
76 .\" The domain error is generated at least as far back as glibc 2.4
77 and a NaN is returned.
79 If the result overflows,
81 .\" The range error is generated at least as far back as glibc 2.4
82 and the functions return
87 respectively, with the mathematically correct sign.
89 If result underflows, and is not representable,
92 .\" POSIX.1 does not specify the sign of the zero,
93 .\" but http://sources.redhat.com/bugzilla/show_bug.cgi?id=2678
94 .\" points out that the zero has the wrong sign in some cases.
96 Except as specified below, if
100 is a NaN, the result is a NaN.
104 is +1, the result is 1.0 (even if
110 is 0, the result is 1.0 (even if
119 is an odd integer greater than 0,
120 the result is +0 (\-0).
127 greater than 0 and not an odd integer,
135 is positive infinity or negative infinity,
138 If the absolute value of
143 is negative infinity,
144 the result is positive infinity.
146 If the absolute value of
151 is negative infinity,
154 If the absolute value of
159 is positive infinity,
162 If the absolute value of
167 is positive infinity,
168 the result is positive infinity.
172 is negative infinity,
175 is an odd integer less than 0,
180 is negative infinity,
183 less than 0 and not an odd integer,
188 is negative infinity,
191 is an odd integer greater than 0,
192 the result is negative infinity.
196 is negative infinity,
199 greater than 0 and not an odd integer,
200 the result is positive infinity.
204 is positive infinity,
212 is positive infinity,
216 the result is positive infinity.
223 is an odd integer less than 0,
224 a pole error occurs and
230 with the same sign as
238 is less than 0 and not an odd integer,
239 a pole error occurs and
240 .\" The pole error is generated at least as far back as glibc 2.4
247 .\" FIXME . review status of this error
248 .\" longstanding bug report for glibc:
249 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
250 .\" For negative x, and -large and +large y, glibc 2.8 gives incorrect
252 .\" pow(-0.5,-DBL_MAX)=nan
253 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
254 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
256 .\" pow(-1.5,-DBL_MAX)=nan
257 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
258 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
260 .\" pow(-0.5,DBL_MAX)=nan
261 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
262 .\" FAIL (expected: range-error-underflow (ERANGE, FE_UNDERFLOW); +0)
264 .\" pow(-1.5,DBL_MAX)=nan
265 .\" EDOM FE_INVALID nan; fail-errno fail-except fail-result;
266 .\" FAIL (expected: range-error-overflow (ERANGE, FE_OVERFLOW); +INF)
269 for information on how to determine whether an error has occurred
270 when calling these functions.
272 The following errors can occur:
274 Domain error: \fIx\fP is negative, and \fIy\fP is a finite noninteger
278 An invalid floating-point exception
282 Pole error: \fIx\fP is zero, and \fIy\fP is negative
287 .\" FIXME . glibc 2.8 gives EDOM
288 A divide-by-zero floating-point exception
292 Range error: the result overflows
296 An overflow floating-point exception
300 Range error: the result underflows
304 An underflow floating-point exception
309 The variant returning
316 .\" FIXME . this is as at glibc 2.8; check later if this bug is fixed
317 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6776
321 POSIX.1 says it should be set to
327 then large negative or positive
329 values yield a NaN as the function result, with
335 floating-point exception.
338 one sees this behavior when the absolute value of
340 is greater than about 9.223373e18.
341 .\" see bug http://sources.redhat.com/bugzilla/show_bug.cgi?id=3866
342 .\" and http://sources.redhat.com/bugzilla/show_bug.cgi?id=369
344 In version 2.3.2 and earlier,
345 .\" FIXME . Actually, 2.3.2 is the earliest test result I have; so yet
346 .\" to confirm if this error occurs only in 2.3.2.
347 when an overflow or underflow error occurs, glibc's
349 generates a bogus invalid floating-point exception
351 in addition to the overflow or underflow exception.