Type Function
Library math.*
Return value Number
Revision Current Public Release (2017.3068)
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