A
Amit Bhatia
Hello everyone.
Sorry to be cross posting this on comp.lang.c++ (moderated)
This is a simple question that is causing some problem in one of the classes
that I have designed.
I have two doubles:
double a=2.4;
double b=0.15;
const double VERYTINY = 1.e-30; \\I define how small is small here;
and I know that 2.4 / 0.15 = 8
But if I try to use a statement like
if(fmod(a,b)>VERYTINY)
return false;
then it returns false.(?)
However if I use
if(fmodf(a,b)>VERYTINY)
return false;
then it does return true.
So how should I check if two doubles are multiples of each other?
thanks,
amit.
Sorry to be cross posting this on comp.lang.c++ (moderated)
This is a simple question that is causing some problem in one of the classes
that I have designed.
I have two doubles:
double a=2.4;
double b=0.15;
const double VERYTINY = 1.e-30; \\I define how small is small here;
and I know that 2.4 / 0.15 = 8
But if I try to use a statement like
if(fmod(a,b)>VERYTINY)
return false;
then it returns false.(?)
However if I use
if(fmodf(a,b)>VERYTINY)
return false;
then it does return true.
So how should I check if two doubles are multiples of each other?
thanks,
amit.