Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

pow, powf, powl - power function

&pagelevel(4)&pagelevel

Syntax

#include <math.h>

double pow(double x, double y);
C11
float powl(float x, float y);
long double powl(long double x, long double y); (End)


These functions compute the value xy

x is the base of the exponential function (a floating-point number).

y is the exponent (also a floating-point number).

If x is 0, y must be positive;
if x is negative, y must be an integer value.

Return val.

Value of xy

if x, y and the result lie in the permitted floating-point interval.

 

+/-HUGE_VAL
+/-HUGE_VALF
+/-HUGE_VALL

depending on the function type and the sign of x, if an overflow occurs.
errno is set to indicate the error.

 

1.0

if x and y are both 0.

 

-HUGE_VAL
-HUGE_VALF
-HUGE_VALL

depending on the function type, if x is 0 and y is less than 0.
errno is set to indicate the error.

 

undefined

if x is less than 0 and y is not an integer.
errno is set to indicate the error.

Errors

pow(), powf() and powl() will fail if:

EDOM

The value of x is negative, and y is not an integer.

The value of x is 0, and y is negative.

ERANGE

The value of x would cause an overflow.

See also

exp(), hypot(), log(), log10(), sinh(), sqrt(), math.h.