diff options
author | José Fonseca <[email protected]> | 2010-05-27 16:16:11 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2010-05-30 16:38:41 +0100 |
commit | b57e18c35cf651addecdfb2339768fbb29c257f5 (patch) | |
tree | 74eae731e0b07383a402507d52749798e1c5e2ac /src/gallium/auxiliary/util/u_math.h | |
parent | f503b3dd9d6522abdabab1e25d0652c9d3079421 (diff) |
util: Add inline function for approximate floating point comparison.
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index d1ec13def30..ee52c09e347 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -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. |