I agree. I would probably use a macro:
#define LCMS_EQ(a,b) (fabs((double)(a) - (double)(b)) <= DBL_EPSILON)
if (LCMS_EQ(xyz->X, 0) && LCMS_EQ(xyz->Y, 0) && LCMS_EQ(xyz->Z, 0))
{ ... }
if (LCMS_EQ(L, 0.0)) { ... }
or, if the test is always against 0:
#define LCMS_EQ_ZERO(a) (fabs((double(a)
Several of the conversion routines in cmspcs.c perform explicit comparisons
of double values to 0. Depending on the compiler used and the optimization
parameters, these comparisons can be unreliable. A floating point number may
not be *exactly* 0 - or any other specific number for that matter - alt