Math.pow(base,power)
Top  Previous  Next


SWiSH Player Support
SWF4 or later - Supported Internally

Syntax
Math.pow(base,power)

Arguments
base, power: Numbers or expressions.
If base < 0, then power must be an integer value.

Returns
A number.

Description
Returns base to the power of power.

Samples
Math.pow(3
,2);   // returns 9 (3 * 3)
Math.pow(2
,3);   // returns 8 (2 * 2 * 2)
Math.pow(-2
,3);   // returns -8
Math.pow(2
,-1);   // returns 0.5 (1/2)
Math.pow(2
,0.5);   // returns 1.414213... (square root of 2)
Math.pow(2
,-0.5);   // reutrns 0.707... (1/(square root of 2)
Math.pow(-2
,0.5);   // returns 0. (Error condition, base <0, non integer power)

Note: Requires Advanced Math Support. See here for more information

See Also
Math.exp(), Math.log(), Math.log10(), Converting Log Base
Math.pow() and Math.sqrt().