Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-09-06 11:32:09

Herve Bronnimann <hbr_at_[hidden]> writes:

| By the way and for the record, one thing I learned during our
| discussions (Sylvain, Guillaume and I) when preparing the submission,
| was that !(x < y) and (y <= x) are almost always but not absolutely
| equivalent, even for double which has a total order. I think it's a
| lesson worth sharing.

I think this is true only for an FP system where
numeric_limits<>::has_xxx_NaN is true. I think it is not that
important because NaNs are not floating point values but
*continuation* values.

| The issue is that when x or y is a nan, comparisons involving a nan
| always return false (except != which returns true).
| The issue came up when I asked Guillaume why checking_base::is_empty
| returns !(l <= u) and not (u < l). For representing empty intervals, we
| allow checking_base to use nan (if T has a quiet nan), or to use [1,0]
| otherwise. So the first test !(l <= u) always works no matter whether T
| has quiet nans or not, whereas the second will not work if T has quiet
| nans.

Well, I'm not sure using NaN is a wise choice here. It adds more
confusion that it should. I'm not convinced that a NaN should be
used to represent an ympty interval.

-- Gaby

Boost list run by bdawes at, gregod at, cpdaniel at, john at