Type Function
Library math.*
Return value Number
Revision Release 2023.3686
Keywords fmod


Returns the remainder of the division of x by y that rounds the quotient towards zero.

The remainder of a division operation is the result of subtracting the integral quotient multiplied by the denominator from the numerator:

remainder = numerator - quotient * denominator


math.fmod( x, y )
x (required)

Number. The numerator of the quotient.

y (required)

Number. The denominator of the quotient.


print(math.fmod(5.3, 2))     ---> 1.3
print(math.fmod(1, 0))    ---> NaN