How can I check if a double (to 2 decimals) is a multiple of 5??
as we all know the % operator doesn't work on double data types..
and
fmod() doesn't seem to be very reliabe....
what I want to do is check if payment
is a multiple of .05.
this is what i am trying with fmod(), where remainder
and payment
are both doubles
remainder = fmod(payment, 5)
when i use small decimals such as; .05, .10, .15, .20 i get exponential notation even if I use
cout << setiosflags(ios::showpoint) << setprecision(3) << modulo << " space " << payment << endl;
not sure what I'm doing wrong