function
<cmath> <ctgmath>
powdouble pow (double base, double exponent);
double pow (double base , double exponent); float powf (float base , float exponent);long double powl (long double base, long double exponent);
double pow (double base , double exponent); float pow (float base , float exponent);long double pow (long double base, long double exponent); double pow (double base , int exponent);long double pow (long double base, int exponent);
double pow (double base , double exponent); float pow (float base , float exponent);long double pow (long double base, long double exponent); double pow (Type1 base , Type2 exponent); // additional overloads
Raise to power
Returns base raised to the power exponent:baseexponent
Header
<tgmath.h>provides a type-generic macro version of this function.
are provided in this header (
<cmath>
) for other combinations of
arithmetic types(
Type1and
Type2): These overloads effectively cast its arguments to
double
before calculations, except if at least one of the arguments is of type
long double
(in which case both are casted to
long double
instead).
This function is also overloaded in <complex>
and <valarray>
(see complex pow and valarray pow).
If the base is finite negative and the exponent is finite but not an integer value, it causes a domain error.
If a
domain erroroccurs, the global variable
errnois set to
EDOM.
If a
poleor
range erroroccurs, the global variable
errnois set
ERANGE.
1
2
3
4
5
6
7
8
9
10
11
/* pow example */
#include <stdio.h> /* printf */
#include <math.h> /* pow */
int main ()
{
printf ("7 ^ 3 = %f\n", pow (7.0, 3.0) );
printf ("4.73 ^ 12 = %f\n", pow (4.73, 12.0) );
printf ("32.01 ^ 1.54 = %f\n", pow (32.01, 1.54) );
return 0;
}
7 ^ 3 = 343.000000 4.73 ^ 12 = 125410439.217423 32.01 ^ 1.54 = 208.036691
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4