 Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-12-08 17:00:44

Guillaume Melquiond <guillaume.melquiond_at_[hidden]> writes:

> Le jeudi 08 décembre 2005 à 07:23 -0500, David Abrahams a écrit :
>
>> > The documentation means that empty() generates the empty subset and
>> > whole() generates the subset
>>
>> Of what? The universe of all possible intervals?

Do you understand that talking about subsets is no good if you don't
say what the superset is?

>> This is a static function!

Do you understand why the fact that it's a static function might be
confusing? We know intervals represent sets, yet the static function
can't return a subset of an interval, because there's no interval
object to operate on.

>> > that is the whole set. Maybe the documentation should stress that
>> > something empty does not contain any element
>
> As I said, intervals are a subset of a given set. This set is implicitly
> described by the template arguments of the interval type. For example,
> with the default interval<double>, the set is the field of real numbers
> (and not just the set of double-precision floating-point numbers). So
> interval<double>::whole() contains all the real numbers.
>
>> > If you want to express these intervals as pair of bounds [l,u], for the
>> > empty subset there must be no x such that l <= x <= u (by having !(l <=
>> > u) for example), and for the whole set, any x must verify l <= x <= u
>> > (by having l = -infinity and u = +infinity for example).
>>
>> ... okay, then you do mean the universe. So why don't you just tell
>> us that empty() includes no values of the underlying type while
>> whole() includes all non-NAN values of the underlying type?
>
> Because this is false. To continue with the example of interval<double>,
> there are intervals of real numbers that do not contain any value of the
> underlying type (I assume you meant the type of the bounds), yet they
> are not empty. So interval<double>::empty() is not just empty with
> respect to floating-point numbers, it is also empty with respect to the
> set of real numbers.
>
> This distinction is important, because we are not just looking if
> elements are in intervals, we are doing arithmetic on intervals. If
> interval<double>::empty() was simply defined as not containing any
> double-precision number, then the sum of two empty intervals would have
> to return the whole set, in order to respect the inclusion property.
>
> In conclusion, empty() still represents the set (properly typed for the
> sake of C++) that contains no elements. And whole() represents the whole
> set as implied by the policies of the interval type.

Okay, I understand why you've chosen to use that particular language.
Do you understand why it isn't sufficient without some additional
context, and are you planning to address that?

```--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
```