Math
Functions
Returns the absolute value of the given number.
Math.abs(1) == 1
Math.abs(-1) == 1
Returns the inverse cosine of the given angle in radians
Returns the inverse hyperbolic cosine of the given angle in radians
Returns the inverse sine of the given angle in radians
Returns the inverse hyperbolic sine of the given angle in radians
Returns the inverse tangent of the given angle in radians
Returns the angle in the plane (in radians) between the positive x-axis and the ray from (0, 0) to the point (x, y)
Returns the inverse hyperbolic tangent of the given angle in radians
Returns the cubic root of the given number
Math.cbrt(1) == 1
Math.cbrt(64) == 4
Returns the smallest integer greater than or equal to the given number.
Math.ceil(0.3) == 1
Clamps the given number between the given upper and lower bounds.
Math.clamp(100, 0, 10) == 10
Math.clamp(-100, 0, 10) == 0
Returns the number of leading zero bits in the 32-bit binary representation of a number
00000000000000000000000000000100 Math.clz32(4) == 29
Returns the cosine of the given angle in radians
Returns the hyperbolic cosine of the given angle in radians
Returns the value of Math:E
raised to the power x, where x is the given number
Returns the value of Math:E
to the power x, minus 1
Math.exp(2) == 7.38905609893065
Math.expm1(2) == 6.38905609893065
Returns the largest integer less than or equal to the given number.
Math.floor(0.8) == 0
Returns the floating-point remainder of two numbers.
Math.fmod(2, 5.3) == 1.3
Math.fmod(4.2, 18.5) == 1.7
Returns the nearest 32-bit single precision float representation of the given number.
Returns the square root of the sum of squares of its arguments.
Math.hypot(3, 4) == 5
Returns the result using C-like 32-bit multiplication of the two parameters.
Math.imul(3, 4) == 12
Returns natural logarithm (base e) of the given value
Math.log(1) == 0
Returns natural logarithm (base 10) of the given value
Math.log10(100) == 10
Returns natural logarithm (base e) of the given value, plus 1
Math.log1p(1) == 0
Returns natural logarithm (base 2) of the given value
Math.log2(8) == 3
Returns the highest-valued number from the arguments.
Math.max(1, 2) == 2
Returns the lowest-valued number from the arguments.
Math.min(1, 2) == 1
Negates the given number.
Math.negate(1) == -1
Returns the exponent power of the given number.
Math.pow(2, 2) == 4
Returns a pseudo-random number in the range 0 to less than 1.
Returns the value of a number rounded to the nearest integer.
Math.round(0.5) == 1
Returns the sign of the given number (1 or -1)
Math.sign(5) == 1
Math.sign(-5) == -1
Calculates the sine of the given angle in radians
Calculates the hyperbolic sine of the given angle in radians
Returns the square root of the given number
Math.sqrt(4) == 2
Calculates the tangent of the given angle in radians
Calculates the hyperbolic tangent of the given angle in radians
Returns the integer part of a number by removing any fractional digits.
Math.trunc(13.37) == 13
Math.trunc(42.84) == 42
Truncates the given number to the given amount.
Math.truncate(0.123456, 2) == 0.12