Here are several built-in functions used for rounding.
The math.floor unction rounds the number passed as parameter to its nearest integer in downward direction:
The Math.ceil() function rounds a number up to the next largest whole number or integer:
The math.round() function returns a number value which is rounded to the nearest integer:
The math.trunc() function removes any fractional digits and returns the integer part of a number:
The parseInt() function parses the string argument and returns an integer of the given radix.
The double bitwise not (~~) Operator
The ~~ operator rounds a number towards 0 if the operand is a number and it’s not NaN or Infinity.
The bitwise OR (|) Operator
The OR operator rounds a number towards 0.
The shift (>>) Operator
The shift operator rounds a number towards 0:
The unsigned shift (>>>) Operator
The unsigned shift rounds a number towards 0:
The XOR (^) Operator