math.roundtoeven() function

The math.roundtoeven() function returns the nearest integer, rounding ties to even.

*Output data type: Float*

  1. import "math"
  2. math.roundtoeven(x: 3.14)
  3. // Returns 3.0
  4. math.roundtoeven(x: 3.5)
  5. // Returns 4.0

Parameters

x

The value used in the operation.

*Data type: Float*

Special cases

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