On May 30, 9:52 am, Barry Schwarz <(E-Mail Removed)> wrote:

> This checks for a == b, not a >= b.

>

> if (a + EPSILON >= b) would be the corresponding check for >=.

>

> However, you should read 14.5 in the c-faq (www.c-faq.com) to see why

> an unscaled EPSILON is a bad idea.
So do you think it will be better to use the relative difference

method as suggested in the C faq 14.5 ?

#define Abs(x) ((x) < 0 ? -(x) : (x))

#define Max(a, b) ((a) > (b) ? (a) : (b))

double RelDif(double a, double b)

{

double c = Abs(a);

double d = Abs(b);

d = Max(c, d);

return d == 0.0 ? 0.0 : Abs(a - b) / d;

}

....

to check for a >= b,

if(RelDif(a, b) <= TOLERANCE || a > b)

...

Btw the floating point data that I'm reading has 6 places after the

decimal point so I though I would take a tolerance value of 0.000001.