math.round() function

The math.round() function returns the nearest integer, rounding half away from zero.

*Output data type: Float*

  1. import "math"
  2. math.round(x: 2.12)
  3. // Returns 2.0

Parameters

x

The value used in the operation.

*Data type: Float*

Special cases

  1. math.round(x: ±0) // Returns ±0
  2. math.round(x: ±Inf) // Returns ±Inf
  3. math.round(x: NaN) // Returns NaN