mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-28 05:20:23 +01:00
util: Add inline function for approximate floating point comparison.
This commit is contained in:
parent
f503b3dd9d
commit
b57e18c35c
1 changed files with 9 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue