pow [C++ Reference]
Keywords: c,math,pow
Date: 2009-03-19T23:49:45-0700

[[pow]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## pow

Syntax:

        #include <cmath>
        double pow( double base, double exp );

The pow() function returns base raised to the expth power. There's a domain error if base is zero and exp is less than or equal to zero. There's also a domain error if base is negative and exp is not an integer. There's a range error if an overflow occurs.

C++ also provides the following overloaded forms:

        #include <cmath>
        float pow( float base, float exp ); // same as powf() in C99
        long double pow( long double base, long double exp ); // same as powl() in C99

C++ also provides overloaded versions of pow() that perform integer exponentiation:

        #include <cmath>
        float pow( float base, int exp );
        double pow( double base, int exp );
        long double pow( long double base, int exp );

Related Topics: exp, log, sqrt

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •