# glsl-1.30: Test range analysis of min and max in the presence of NaN

Mesa currently fails both of these tests.

The range analysis of `min(-abs(x), abs(y))`

says that `-abs(x)`

must be the result. However, if one parameter is NaN, min (and max) will always choose the parameter that is a number. Therefore, if `x`

is NaN, the result will be `abs(y)`

.

Some optimizations use this knowledge to eliminate comparisons. Some examples:

```
(('fge', 'a(is_lt_zero)', 'b(is_not_negative)'), False),
(('flt', 'a(is_not_negative)', 'b(is_not_positive)'), False),
```

These reductions are "exact" if either `a`

or `b`

is NaN, but they are not exact if range analysis provides incorrect range information.

I have a fix in testing now.