math.modf() function

The math.modf() function returns integer and fractional floating-point numbers that sum to f. Both values have the same sign as f.

*Output data format: Record*

  1. import "math"
  2. math.modf(f: 3.14)
  3. // Returns {int: 3, frac: 0.14000000000000012}

Parameters

f

The value used in the operation.

*Data type: Float*

Special cases

  1. math.modf(f: ±Inf) // Returns {int: ±Inf, frac: NaN}
  2. math.modf(f: NaN) // Returns {int: NaN, frac: NaN}