1POW(3)                     Linux Programmer's Manual                    POW(3)
2
3
4

NAME

6       pow, powf, powl - power functions
7

SYNOPSIS

9       #include <math.h>
10
11       double pow(double x, double y);
12       float powf(float x, float y);
13       long double powl(long double x, long double y);
14
15       Link with -lm.
16
17   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19       powf(), powl():
20           _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
21           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
22           or cc -std=c99
23

DESCRIPTION

25       The pow() function returns the value of x raised to the power of y.
26

RETURN VALUE

28       On success, these functions return the value of x to the power of y.
29
30       If x is a finite value less than 0, and y is  a  finite  noninteger,  a
31       domain error occurs, and a NaN is returned.
32
33       If the result overflows, a range error occurs, and the functions return
34       HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively,  with  the  mathemati‐
35       cally correct sign.
36
37       If  result  underflows, and is not representable, a range error occurs,
38       and 0.0 is returned.
39
40       Except as specified below, if x or y is a NaN, the result is a NaN.
41
42       If x is +1, the result is 1.0 (even if y is a NaN).
43
44       If y is 0, the result is 1.0 (even if x is a NaN).
45
46       If x is +0 (-0), and y is an odd integer greater than 0, the result  is
47       +0 (-0).
48
49       If  x  is 0, and y greater than 0 and not an odd integer, the result is
50       +0.
51
52       If x is -1, and y is positive infinity or negative infinity, the result
53       is 1.0.
54
55       If  the absolute value of x is less than 1, and y is negative infinity,
56       the result is positive infinity.
57
58       If the absolute value of x is greater than 1, and y is negative  infin‐
59       ity, the result is +0.
60
61       If  the absolute value of x is less than 1, and y is positive infinity,
62       the result is +0.
63
64       If the absolute value of x is greater than 1, and y is positive  infin‐
65       ity, the result is positive infinity.
66
67       If  x  is  negative  infinity, and y is an odd integer less than 0, the
68       result is -0.
69
70       If x is negative infinity, and y less than 0 and not  an  odd  integer,
71       the result is +0.
72
73       If  x is negative infinity, and y is an odd integer greater than 0, the
74       result is negative infinity.
75
76       If x is negative infinity, and y greater than 0 and not an odd integer,
77       the result is positive infinity.
78
79       If x is positive infinity, and y less than 0, the result is +0.
80
81       If x is positive infinity, and y greater than 0, the result is positive
82       infinity.
83
84       If x is +0 or -0, and y is an odd integer less than  0,  a  pole  error
85       occurs  and  HUGE_VAL,  HUGE_VALF,  or HUGE_VALL, is returned, with the
86       same sign as x.
87
88       If x is +0 or -0, and y is less than 0 and not an odd integer,  a  pole
89       error occurs and +HUGE_VAL, +HUGE_VALF, or +HUGE_VALL, is returned.
90

ERRORS

92       See  math_error(7) for information on how to determine whether an error
93       has occurred when calling these functions.
94
95       The following errors can occur:
96
97       Domain error: x is negative, and y is a finite noninteger
98              errno is set  to  EDOM.   An  invalid  floating-point  exception
99              (FE_INVALID) is raised.
100
101       Pole error: x is zero, and y is negative
102              errno  is set to ERANGE (but see BUGS).  A divide-by-zero float‐
103              ing-point exception (FE_DIVBYZERO) is raised.
104
105       Range error: the result overflows
106              errno is set to ERANGE.  An  overflow  floating-point  exception
107              (FE_OVERFLOW) is raised.
108
109       Range error: the result underflows
110              errno  is  set to ERANGE.  An underflow floating-point exception
111              (FE_UNDERFLOW) is raised.
112

CONFORMING TO

114       C99, POSIX.1-2001.  The variant returning double also conforms to SVr4,
115       4.3BSD, C89.
116

BUGS

118       In  glibc  2.9  and  earlier, when a pole error occurs, errno is set to
119       EDOM instead of the POSIX-mandated ERANGE.  Since version  2.10,  glibc
120       does the right thing.
121
122       If  x is negative, then large negative or positive y values yield a NaN
123       as the function  result,  with  errno  set  to  EDOM,  and  an  invalid
124       (FE_INVALID)  floating-point  exception.   For example, with pow(), one
125       sees this behavior when the absolute value of y is greater  than  about
126       9.223373e18.
127
128       In  version  2.3.2  and  earlier,  when  an overflow or underflow error
129       occurs, glibc's pow() generates a bogus invalid  floating-point  excep‐
130       tion (FE_INVALID) in addition to the overflow or underflow exception.
131

SEE ALSO

133       cbrt(3), cpow(3), sqrt(3)
134

COLOPHON

136       This  page  is  part of release 3.53 of the Linux man-pages project.  A
137       description of the project, and information about reporting  bugs,  can
138       be found at http://www.kernel.org/doc/man-pages/.
139
140
141
142                                  2010-09-12                            POW(3)
Impressum