Gets a number raised to the exponential power of another
number.
| Parameter |
Description |
x |
The base number in x raised
to the power of y. See below for special cases. |
y |
The exponent in x raised to
the power of y. |
| Return value |
Description |
double |
The first parameter raised to the power of the
second parameter. |
Usage
Special cases are as follows:
- The following yield
NaN:
- exponent
NaN
- base
NaN and exponent not 0
- base
1 and exponent Infinity
- base less than
0 and exponent not integer
- The following yield
+Infinity:
- base greater than
1 and exponent +Infinity
- base less than
1 and exponent -Infinity
- base
+0 and exponent less than 0
- base
+Infinity and exponent greater than 0
- base
-0 and exponent a positive finite odd integer
- base
-Infinity and exponent greater than 0 but
not a negative finite odd integer
- The following yield
-Infinity:
- base
-0 and exponent a negative finite odd integer
- base
-Infinity and exponent a positive finite
odd integer
- The following yield
+0:
- base greater than
1 and exponent -Infinity
- base less than
1 and exponent +Infinity
- base
+0 and exponent greater than 0
- base
+Infinity and exponent less than 0
- base
-0 and exponent greater than 0 but
not a finite odd integer
- base
-Infinity and exponent greater than 0 but
not a finite odd integer
- The following yield
-0:
- base
-0 and exponent a positive finite odd integer
- base
-Infinity and exponent a negative finite
odd integer
- The following yields the absolute base raised to the exponent:
base less than
0 and exponent a finite even integer
- The following yields the negative of the absolute base raised
to the exponent: base less than
0 and exponent a
finite odd integer
Examples
This button
onclick event
calculates the power of a number.
sessionScope.result =
Math.pow(sessionScope.n, sessionScope.power)