The math.fmod() function is used to calculate the remainder after a division between two numbers. It returns the remainder after the first number is divided by the second number.  For example: math.fmod(10, 3) This will return the result 1, as 10 divided by 3 is 3 with a remainder of 1.

math.fmod(number1, number2) 

Where number1 is the first number that will be divided and number2 is the second number.   

The function returns the remainder of number1/number2 as a floating point value.

The returned value is always in the same range as the first number. This means that if the first number is negative, the result of math.fmod() will also be negative.

import math

math.fmod(10, 3)
math.fmod(-15, 4)
math.fmod(15, -4)
math.fmod(-20, 5)
math.fmod(20, 6)
math.fmod(25, 5)
math.fmod(63, 7)
math.fmod(100, 11)
math.fmod(1000, 67)