The Javascript Math object sports a set of built-in methods and constants for performing mathematical calculations in scripts.
• ceil - round a decimal number up to a whole number regardless of decimal value
• floor - round a decimal number down to a whole number regardless of decimal value
• max - returns the largest number out of a set of numbers
• min - returns the smallest number out of a set of numbers
• random - returns a random decimal number between "0" and "1"
• round - round a decimal number naturally
• sqrt - returns the square root of a number
Trigonometric Methods of the Math Object
• abs - returns the distance a number must go to reach 0
• acos - returns the arc cosine of a number(number range: -1.0 to 1.0)
• asin - returns the arc sine of a number (number range: -1.0 to 1.0)
• atan - returns the arctangent of a number
• atan2 - returns the arctangent of the quotient of its arguments(Ypoint,Xpoint)
• cos - returns the cosine of the number (returns a value between -1 and 1)
• log - returns the natural logarithm of a number
• pow - returns base number to the exponent power
• sin - returns the sine of a number
• tan - returns the tangent of a number
• E - Euler's constant. The base of Natural Logarithms.
• LN2 - Natural logarithm of 2
• LN10 - Natural logarithm of 10
• LOG2E - Base 2 logarithm of E
• LOG10E - Base 10 logarithm of E
• PI - Ratio of a circle's circumference to its diameter
• SQRT1_2 - Square root of 1/2
• SQRT2 - Square root of 2
Formula for calculating radians:
radians = degrees * Math.PI/180
Formula for calculating degrees from radians:
degrees = radians * 180/Math.PI