JavaScript Math Object


Math Object Properties
Constant e Math.E
Natural logarithm of 2 Math.LN2
Natural logarithm of 10 Math.LN10
Base 2 logarithm of e Math.LOG2E
Base 10 logarithm of e Math.LOG10E
Constant pi Math.PI
Square root of 1/2 Math.SQRT1_2
Square root of 2 Math.SQRT2
Math Object Methods
INPUT X and Y x = y =
Absolute value of x Math.abs(x)
Arccosine of x Math.acos(x)
Arcsine of x Math.asin(x)
Arctangent of x Math.atan(x)
Arctangent of x/y Math.atan2(x,y)
x rounded up to nearest integer Math.ceil(x)
Cosine of x Math.cos(x)
e to the power of x Math.exp(x)
x rounded down to the nearest integer Math.floor(x)
Log of x Math.log(x)
Maximum of x and y Math.max(x,y)
Minimum of x and y Math.min(x,y)
x raised to the power of y Math.pow(x,y)
Random number Math.random()
x rounded to the nearest integer Math.round(x)
Sine of x Math.sin(x)
Square root of x Math.sqrt(x)
Tangent of x Math.tan(x)

Jim O'Donnell, jim@odonnell.org