HTML and CSS Reference
In-Depth Information
Table 9.5
Math
Object Properties (continued)
Property
Value
Description
Math.LOG2E
1.442695040888963387
Log base-2 of E
Math.Log10E
0.4342944819032518167
Log base-10 of E
Math.PI
3.14592653589793116
Pi, ratio of the circumference of a
circle to its diameter
Math.SQRT1_2
0.7071067811865475727
1 divided by the square root of 2
Math.SQRT2
1.414213562373985145
Square root of 2
Table 9.6
Math
Object Methods
Method
Functionality
Math.abs(Number)
Returns the absolute (unsigned) value of
Number
Math.acos(Number)
Arc cosine of
Number
, returns result in radians
Math.asin(Number)
Arc sine of
Number
, returns results in radians
Math.atan(Number)
Arctangent of
Number
, returns results in radians
Math.atan2(y,x)
Arctangent of
y
/
x
; returns arctangent of the quotient of its
arguments
Math.ceil(Number)
Rounds
Number
up to the next closest integer
Math.cos(Number)
Returns the cosine of
Number
in radians
Math.exp(x)*
Euler's constant to some power
Math.floor(Number)
Rounds
Number
down to the next closest integer
Math.log(Number)
Returns the natural logarithm of
Number
(base E)
Math.max(Number1, Number2)
Returns larger value of
Number1
and
Number2
Math.min(Number1, Number2)
Returns smaller value of
Number1
and
Number2
Math.pow(x, y)
Returns the value of
x
to the power of
y
(
x
y
), where
x
is the
base and
y
is the exponent
Math.random()
Generates pseudorandom number between 0.0 and 1.0
Math.round(Number)
Rounds
Number
to the closest integer
Math.sin(Number)
Arc sine of
Number
in radians
Math.sqrt(Number)
Square root of
Number