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           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
22               || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
23

DESCRIPTION

25       These functions return 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

ATTRIBUTES

114       For   an   explanation   of   the  terms  used  in  this  section,  see
115       attributes(7).
116
117       ┌──────────────────────┬───────────────┬─────────┐
118Interface             Attribute     Value   
119       ├──────────────────────┼───────────────┼─────────┤
120pow(), powf(), powl() │ Thread safety │ MT-Safe │
121       └──────────────────────┴───────────────┴─────────┘

CONFORMING TO

123       C99, POSIX.1-2001, POSIX.1-2008.
124
125       The variant returning double also conforms to SVr4, 4.3BSD, C89.
126

BUGS

128       On 64-bits, pow() may be more than 10,000 times slower for some  (rare)
129       inputs  than for other nearby inputs.  This affects only pow(), and not
130       powf() nor powl().
131
132       In glibc 2.9 and earlier, when a pole error occurs,  errno  is  set  to
133       EDOM  instead  of the POSIX-mandated ERANGE.  Since version 2.10, glibc
134       does the right thing.
135
136       If x is negative, then large negative or positive y values yield a  NaN
137       as  the  function  result,  with  errno  set  to  EDOM,  and an invalid
138       (FE_INVALID) floating-point exception.  For example,  with  pow(),  one
139       sees  this  behavior when the absolute value of y is greater than about
140       9.223373e18.
141
142       In version 2.3.2 and earlier,  when  an  overflow  or  underflow  error
143       occurs,  glibc's  pow() generates a bogus invalid floating-point excep‐
144       tion (FE_INVALID) in addition to the overflow or underflow exception.
145

SEE ALSO

147       cbrt(3), cpow(3), sqrt(3)
148

COLOPHON

150       This page is part of release 5.04 of the Linux  man-pages  project.   A
151       description  of  the project, information about reporting bugs, and the
152       latest    version    of    this    page,    can     be     found     at
153       https://www.kernel.org/doc/man-pages/.
154
155
156
157                                  2017-09-15                            POW(3)
Impressum