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:
@@ -3099,6 +3099,17 @@ quite efficient.)
|
||||
uniform unsigned int low,
|
||||
uniform unsigned int high)
|
||||
|
||||
The ``isnan()`` functions test whether the given value is a floating-point
|
||||
"not a number" value:
|
||||
|
||||
::
|
||||
|
||||
bool isnan(float v)
|
||||
uniform bool isnan(uniform float v)
|
||||
bool isnan(double v)
|
||||
uniform bool isnan(uniform double v)
|
||||
|
||||
|
||||
Transcendental Functions
|
||||
------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user