I'm having an issue with fmod() where it doesn't "suit" the conditions in a while loop when used with a parameter. I've recreated the snippet below, which causes the same error as my main program.
#include <math.h>
int main()
{
double foo = 223.76;
double bar = foo;
while(fmod(bar,1.00) != 0)
{
bar += foo;
}
cout << bar << endl;
}
The above code should eventually stop and print out 5594, but instead it continues into the millions. Printing out the value of bar during each step does in fact show that it reaches the value of 5594 (it takes around 25 steps if you want to test it), so I can't figure out why it doesn't stop there.