math.trunc() function

The math.trunc() function returns the integer value of x.

*Output data type: Float*

  1. import "math"
  2. math.trunc(x: 3.14)
  3. // Returns 3.0

Parameters

x

The value used in the operation.

*Data type: Float*

Special cases

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