JavaScript: Math object reference
Lists the Math object methods and properties.
Back to JavaScript: Maths
Math object functions (methods):
abs(x) |
Returns the absolute value of x. |
acos(x) |
Returns the arccosine of x in radians. That is the angle in radians of the cosine value x. The inverse function of cos(x). |
asin(x) |
Returns the arcsine of x in radians. That is the angle in radians of the sin value x. The inverse function of sin(x). |
atan(x) |
Returns the arctangent of x in radians. That is the angle in radians of the tangent value x. The inverse function of tan(x). |
atan2(y,x) |
Returns the angle in radians of the coordinate (x,y). Note that the arguments are passed in the opposite order. Angle is measured from the positive x-axis and the returned value is within the range pi and >-pi. |
ceil(x) |
Returns the value rounded up to the nearest integer. |
cos(x) |
Returns the cosine of radian angle x. |
exp(x) |
Returns e to the power of x. |
floor(x) |
Returns the value rounded down to the nearest integer. |
log(x) |
Returns the natural logarithm base e of x. |
max(x,y) |
Returns the greater of x and y. |
min(x,y) |
Returns the lesser of x and y. |
pow(x,y) |
Returns x to the power of y. |
random() |
Returns a random number between 0 and 1. |
round(x) |
Returns x rounded to the closest integer. |
sin(x) |
Returns the sine of radian angle x. |
sqrt(x) |
Returns the square root of x. |
tan(x) |
Returns the tangent of radian angle x. |
Math object constants (properties):
E |
Euler's constant. Approx 2.71828. |
LN2 |
The natural logarithm of 2. Approx 0.693. |
LN10 |
The natural logarithm of 10. Approx 2.302585. |
LOG2E |
The base 2 logarithm of E. Approx 1.442695. |
LOG10E |
The base 10 logarithm of E. Approx 0.434. |
PI |
The constant pi. Approx 3.141592. |
SQRT1_2 |
The square root of 1/2. Approx 0.707. |
SQRT2 |
The square root of 2. Approx 1.4142. |
Back to top.
Copyright © 2006-2010 justfigures.co.uk
