math.mod() function

The math.mod() function returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.

*Output data type: Float*

  1. import "math"
  2. math.mod(x: 1.23, y: 4.56)
  3. // Returns 1.23

Parameters

x

The X value used in the operation.

*Data type: Float*

y

The Y value used in the operation.

*Data type: Float*

Special cases

  1. math.mod(x: ±Inf, y:y) // Returns NaN
  2. math.mod(x: NaN, y:y) // Returns NaN
  3. math.mod(x:x, y: 0) // Returns NaN
  4. math.mod(x:x, y: ±Inf) // Returns x
  5. math.mod(x:x, y: NaN) // Returns NaN