A
Amit Bhatia
Hi there.
I am restarting this thread as I still can't find a good enough fix for the
problem I am facing:
For example:
double a= 0.15;
double b=2.4;
const double VERYTINY =1.e-10;
I know b/a = 16 and hence the remainder is zero; but I am not
able to find any suitable thing to encode it into in c.
for example (fmod(b,a)>VERYTINY) returns true!
Now for this particular instance, (fmodf(b,a)>VERYTINY)
does return false.
But now if
a=0.15;
b=4.5;
then fmodf and fmod both don't help...
any suggestions on this?
I was pointed to a reference on floating point arithmetic, where they talk
of ulps etc, but is there a small function or fix to deal with this problem
available somewhere?
thanks,
amit.
I am restarting this thread as I still can't find a good enough fix for the
problem I am facing:
For example:
double a= 0.15;
double b=2.4;
const double VERYTINY =1.e-10;
I know b/a = 16 and hence the remainder is zero; but I am not
able to find any suitable thing to encode it into in c.
for example (fmod(b,a)>VERYTINY) returns true!
Now for this particular instance, (fmodf(b,a)>VERYTINY)
does return false.
But now if
a=0.15;
b=4.5;
then fmodf and fmod both don't help...
any suggestions on this?
I was pointed to a reference on floating point arithmetic, where they talk
of ulps etc, but is there a small function or fix to deal with this problem
available somewhere?
thanks,
amit.