Switch to unordered floating point compares.

In particular, this gives us desired behavior for NaNs (all compares
involving a NaN evaluate to true).  This in turn allows writing the
canonical isnan() function as "v != v".

Added isnan() to the standard library as well.
This commit is contained in:
Matt Pharr
2012-06-20 13:24:09 -07:00
parent 3bc66136b2
commit 46716aada3
6 changed files with 40 additions and 9 deletions

View File

@@ -10,7 +10,7 @@ export void f_v(uniform float RET[]) {
h = float_to_half(f);
// may return a different value back for NaNs..
if (f == f && i != h)
if (!isnan(f) && i != h)
++errors;
}
RET[programIndex] = errors;