util: Add inline function for approximate floating point comparison.

This commit is contained in:
José Fonseca
2010-05-27 16:16:11 +01:00
parent f503b3dd9d
commit b57e18c35c

View File

@@ -335,6 +335,15 @@ util_iround(float f)
}
/**
* Approximate floating point comparison
*/
static INLINE boolean
util_is_approx(float a, float b, float tol)
{
return fabs(b - a) <= tol;
}
/**
* Test if x is NaN or +/- infinity.