Mathematical Constants and Functions available in JavaScript

Constants

Ee (base of natural logarithms)
LN10The natural logarithm of 10
LOG10EThe base 10 logarithm of e
LOG2EThe base logarithm of e
PI3.14159265....
SQRT1_2reciprocal of the square root of 2
SQRT2the square root of 2

Functions

abs(x)absolute value of x
acos(x)angle (radians) whose cosine is x
asin(x)angle (radians) whose sine is x
atan(x)angle (radians) whose tangent is x
atan2(x,y)angle (radians) whose tangent is y/x
ceil(x)nearest integer greater than or equal to x
cos(x)cosine of the angle x (radians)
exp(x)e to the power x
floor(x)nearest integer less than or equal to x
log(x)natural logarithm of x
max(x,y)larger of x and y
min(x,y)smaller of x and y
pow(x,y)x raised to the power y
round(x)integer nearest to x
sin(x)sine of the angle x (radians)
sqrt(x)square root of x
tan(x)tangent of x (radians)