I am not an expert in programming, and I am facing the following issue.
I need to compute modulo between floats A and B. So I use fmod((double)A, (double)B). Theorically, if A is a multiple of B, then the result is 0.0. However, due to floating point precision purpose, A and B are not exactly the number I expected to have. Then, the result of the modulo computation is not 0.0, but something different. Which is problematic.
Example: A=99999.9, but the compiler interprets it as 99999.898. B=99.9, but the compiler interprets it as 99.900002. fmod(A,B) expected to be 0.0, but gives actually 99.9.
So the question is: how do you use to manage this kind of situation ?
Thank you