The function returns the real remainder of division of two numbers.
[in] Dividend value.
[in] Divisor value.
The MathMod function calculates the real remainder f from expression val/y so that val = i * y + f , where i is an integer, f has the same sign as val, and the absolute value of f is less than the absolute value of y.
Instead of MathMod() you can use fmod().