projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f503b3d
)
util: Add inline function for approximate floating point comparison.
author
José Fonseca
<jfonseca@vmware.com>
Thu, 27 May 2010 15:16:11 +0000
(16:16 +0100)
committer
José Fonseca
<jfonseca@vmware.com>
Sun, 30 May 2010 15:38:41 +0000
(16:38 +0100)
src/gallium/auxiliary/util/u_math.h
patch
|
blob
|
history
diff --git
a/src/gallium/auxiliary/util/u_math.h
b/src/gallium/auxiliary/util/u_math.h
index d1ec13def30f831e81a11f95d65b917ef4177cb2..ee52c09e3476cbdab965445242dbcf72a8082874 100644
(file)
--- 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.