Math
Functions
Returns the absolute value of the given number.
Math.abs(1) == 1
Math.abs(-1) == 1
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 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 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 square root of the given number
Math.sqrt(4) == 2
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