Type Function Library math.* Return value Number Revision Release 2024.3703 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 )
Number. The numerator of the quotient.
Number. The denominator of the quotient.
print(math.fmod(5.3, 2)) ---> 1.3 print(math.fmod(1, 0)) ---> NaN