pow

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)(C99)(C99)
Exponential functions
(C99)
(C99)
(C99)
(C99)
Power functions
(C99)
(C99)
pow
Trigonometric and hyperbolic functions
(C99)
(C99)
(C99)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Nearest integer floating point operations
(C99)(C99)(C99)
(C99)
(C99)
(C99)(C99)(C99)
Floating point manipulation functions
(C99)(C99)
(C99)
(C99)
Classification
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)
Macro constants
 
Defined in header <math.h>
float       powf( float base, float exp );
(since C99)
double      pow( double base, double exp );
long double powl( long double base, long double exp );
(since C99)

Computes the value of base raised to the power exp or iexp.

[edit] Parameters

base - base as floating point value
exp - exponent as floating point value
iexp - exponent as integer value

[edit] Return value

base raised by power (exp or iexp).

Domain error occurs if base is 0 and exp is less than or equal to 0. NAN is returned in that case.

Domain error occurs if base is negative and exp is not an integer value. NAN is returned in that case.

Range error occurs if an overflow takes place. HUGEVAL is returned in that case.

If domain error occurs and math_errhandling & MATH_ERRNO is nonzero, errno is set to EDOM.

If domain error occurs and math_errhandling & MATH_ERREXCEPT is nonzero, the invalid floating point exception is raised.

If range error occurs and math_errhandling & MATH_ERRNO is nonzero, errno is set to ERANGE.

If range error occurs and math_errhandling & MATH_ERREXCEPT is nonzero, the overflow floating point exception is raised.

(since C99)

[edit] See also

returns e raised to the given power (ex)
(function)
computes natural (base e) logarithm (to base e) (ln(x))
(function)
computes square root (x)
(function)
(C99)
computes cubic root (3x)
(function)