I have this code:
double a = remainder(92.66, 0.01);
double b = remainder(92.87, 0.01);
And it turns out that a = -5.33948e-15
and b = -2.61423e-15
The answer here is clearly zero, and if I multiplied both numbers by 100 and did integer modulus it would be. But I'd like to be able to do this using doubles. The problem is that remainder is returning a number that is bigger than DBL_EPSILON - so what is the correct(best approximation) way to determine whether a
or b
is ~zero?