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(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
20       _ISOC99_SOURCE; or cc -std=c99
21

DESCRIPTION

23       The pow() function returns the value of x raised to the power of y.
24

RETURN VALUE

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

ERRORS

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

CONFORMING TO

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

BUGS

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

SEE ALSO

130       cbrt(3), cpow(3), sqrt(3)
131

COLOPHON

133       This page is part of release 3.22 of the Linux  man-pages  project.   A
134       description  of  the project, and information about reporting bugs, can
135       be found at http://www.kernel.org/doc/man-pages/.
136
137
138
139                                  2008-08-10                            POW(3)
Impressum