math.fmod
The math.fmod function returns the modulus of two numbers as defined in the C platform library. This assumes that the modulus of two numbers a and b is defined as the result of a - n * b for some integer n such that the result has the same sign as a and a magnitude less than the absolute value of b .
Note that this criterion differs from the one used in Python's % operator, which -in addition to applying a different method for the calculation- returns a result that has the sign of b.