Boost logo

Boost :

From: Gennadiy Rozental (gennadiy_at_[hidden])
Date: 2002-09-09 03:38:51


> Supporting "1/[-1;1] = (-inf,-1] && [1,+inf)" would be nice theoretically.
> However, consider a basic real world usage : this division is probably not
the
> only arithmetic operation involved, and this (already catastrophic) result
is
> going to be fed to the following arithmetic operations. For example,
suppose
> it is part of the simple function f(x) = 1/x + x. Even with your better
> multi-interval, f([-1;1]) is still going to become [-inf;inf] right after
the
> following addition. So I do not find this feature important in general.
> At least this example probably does not justify the complexity of dealing
with
> multi-intervals.

I am not exactly understand why you brought namely 1/x + x. What if it is
1/x + x/2?

>
> > 5. Interval lacks notion of iterator
> > I believe it could be convenient in many context to consider interval as
a
> > container and accordingly we need the iterators.
>
> Why not build an external iterator range from lower() and upper() as you
> see fit ? That would be much more flexible than any hard-coding that
> can be done in the interval class, right ?

I can always use lower and upper to do whatever I want.But some default
simple iterator may worth to add. Note that it will become *much* more
interesting when you start dealing with multi-interval. Especially would you
want to support segmented iterators notion from Matt Austern.

> > Implementation:
> >
> > 2. namespace interval_lib is confusing.
> > Everything that is in this library is interval lib. Better name may
be
> > interval_policies.
>
> It's not only the policies though, constants like pi are there too...

Maybe numeric or numeric_interval. BTW I wanted to ask why interval is not
located in boost/numeric as ublas do. This are both libraries for numeric
computations. Note that namely numeric not math, since math is reserved for
pure math abstractions while numeric deals with rounding, precision and so
on.

> > 4. Why constant pi defined only as a double or float. What if I need pi
as
> > miltiprecision_double class value? Maybe it should be computed at
compile
> > time. You may provide precomputed specialization for intrinsic types.
>
> It's also defined for long double (at the same IEEE precision as double
for
> now). It's a job for the math constants library anyway. Once Paul
provides
> nice lower/upper constants, the interval library will fetch them from
there.

I don't believe that it will provide you with constant for every
user-defined number class. As I sad what if I need pi/2 represented as my
fancy miltiprecision_double class value?

> Sylvain

Gennadiy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk