Name
pow
Synopsis
Raises a number to a power
#include <math.h> doublepow
( doublex
, doubley
); floatpowf
( floatx
, floaty
); (C99) long doublepowl
( long doublex
, long doubley
); (C99)
The pow()
function
calculates x
to the power of
y
. In other words, the return value is
x
y. The
arguments are subject to the following rules:
If
x
is negative,y
must have an integer value.If
x
is zero, theny
must not be negative. (00 = 1.0, but for all other positive values ofy
, 0y = 0.0.)
If the arguments violate these conditions, pow()
may return NaN (not a number) or
infinity, and may indicate a domain error. If an overflow or
underflow occurs, pow()
returns
positive or negative HUGE_VAL
and
may indicate a range error.
Example
See the example for cosh()
in this
chapter.
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.