Hi, I'm trying to write a macro for the relative difference function

which is used to check the close enough floating point values. Is

this correct way to write it ? :

#define EPSILON 0.000001

#define max(x, y) ((x) (y) ? (x) : (y))

#define eq(a, b) max(fabs(a), fabs(b)) == 0.0 ? 0.0 : fabs(a - b) /

(max(fabs(a), fabs(b)))

Now for checking if two doubles, say x and y, are close we use eq(a,b)

<= EPSILON