Excluding an interval is now expressible, and excluding zero is just
the [-0.0, +0.0] case of it, so say so.
For some stupid historical reason which I can't remember, the irange
and prange nonzero_p() predicates returns true only for ~[0,0], so
even [5,5] returns false. When we want to test whether a range
contains a zero, we usually use the contains_p() idiom. I think this
is idotic, but perhaps there is a reason for it.
I've implemented the frange version the same way, with the wrinkle
that the constructor for ~[-0.0, +0.0] includes the possibility of
+-NAN, which means that nonzero_p() must ignore the NAN bits,
otherwise anything but a strict ~[-0.0, +0.0] +-NAN would return
false. For example, this:
x = frange(0.0, VR_ANTI_RANGE);
x.clear_nan();
x.nonzero_p(); <-- would return false
Tested on ppc64le Linux: regstrap and LAPACK. Surprisingly there are
no changes to generated output in my Fortran files, presumably because
intersect/union are enough to fold inequalities away, and also because
there are no callers to nonzero_p() for frange. Every nonzero_p()
call is guarded by prange or irange checks, but it's nice to
implement these since they are pure virtuals from the base vrange
class.
gcc/ChangeLog:
* value-range.cc (frange::set_nonzero): Implement.
(frange::nonzero_p): Implement.
(range_tests_excluding): Test set_nonzero and nonzero_p.