##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# pow

From cppreference.com
< c‎ | numeric‎ | math

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

exp | returns e raised to the given power (ex) (function) [edit]
log | computes natural (base e) logarithm (to base e) (ln(x)) (function) [edit]
sqrt | computes square root (√x) (function) [edit]
cbrt (C99) | computes cubic root (3√x) (function) [edit]
C++ documentation for pow

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/numeric/math/pow&oldid=64927"