Math.absReturns the absolute value of its argument, i.e. the positive number with the same magnitude.
Math.abs(-42) ⟹ 42
Math.abs(123) ⟹ 123
Math.sqrtReturns the square root of its argument.
Math.sqrt(4) ⟹ 2
Math.sqrt(2) ⟹ 1.4142135623730951
Math.minReturns the minimum of its arguments.
Math.min(10, 20) ⟹ 10
Math.min(2, -3) ⟹ -3
Math.min(0.5, 0.25) ⟹ 0.25
Math.maxReteurns the maximum of its arguments.
Math.min(10, 20) ⟹ 20
Math.min(2, -3) ⟹ 2
Math.min(0.5, 0.25) ⟹ 0.5
Math.floorReturns its argument rounded down to next whole number.
Math.floor(1.1) ⟹ 1
Math.floor(2.9) ⟹ 2
Math.floor(-10.3) ⟹ -11
Math.ceilReturns its argument rounded up to next whole number. (“Ceil” is short for “ceiling”.)
Math.floor(1.1) ⟹ 2
Math.floor(2.9) ⟹ 3
Math.floor(-10.3) ⟹ -19
Math.floor and %When dealing with positive numbers:
Math.floor(a, b) * b + (a % b) ⟹ a
I.e. Math.floor gives us the whole number of times
b goes into a and
(a % b) gives us the remainder.
Math.abs - absolute value
Math.sqrt - square root
Math.min - minimum value
Math.max - maximum value
Math.floor - round down (toward -∞)
Math.ceil - round up (toward +∞)