Boost logo

Boost :

Subject: Re: [boost] boost interval arithmetic
From: Павел Кудан (coodan_at_[hidden])
Date: 2015-01-15 05:44:36


>That's not what the defintion that boost uses, boost gives you the
>smallest single interval in which the value will be. You are sugesting a
>"multi-interval".
Not completely true.

I just suggest that arithmetic function does not return not correct results. And throw exception in the case when single interval cannot be returned - in same manner with boost interval comparison operators (default behaviour) in similar intermediate situation. To let user know that result is incorrect and he may use 'native' interval boost class functions (divide_part1(), divide_part2() in this case) to get correct result, as operator is not applicable to such situation any more.

>The definition is very clear: it's the smallest *single interval* in which
>the value of the computation will be in. What you want is a multi-interval
>that excludes intervals where you know the value will never be in?
>That's a complete different definition, and it has a costs.
I claim that kind of behaviour as 'misconception' for that reason. Current behaviour is wrong but is in full accordance to class documentation (as it was proved by Mark).

By the way, I think you will agree, that it is not important which is the cost of operation it's result are NOT CORRECT.

>E.g. th eboost definition places a box around the Madelbrot set, what you
>want is and infinite set of boxes with mutual inclusions and exclusions
>that exactly capture the Mandelbrot set. When I do interval arithmic I
>don't want that, I want a single interval and that's what I expect from the
>documentation. Anything other will cause my computation to be slow and it
>will consume exponential memory.
The problem you want single interval as a result of interval operation may be connected the details of class implementation. Single-interval-oriented design of functions force you to think that a result is single interval. But it is not true. In general case a result of interval operation is really the set of intervals. That is not misconception here, of course, that is just implementation detail, convenient for its authors.  But still.

Moreover, you have full right to expect single interval as a result of some operation, moreover again - some operators like /= by its design must return single interval.

The simple question is that this single interval MUST BE correct or exception must be thrown to indicate

>You are aware that there are different definitions of intervals, no? You
>want a different definition and call it a bug, but you should say that you
>want a multi-interval lib.
Boost interval claims to be general purpose solution, expandable to many classes of intervals with its policies. And boost itself is claimed as C++ standard proposal. So there is no space here to cover mistakes and misconfiguration with answer 'It was a sly plan". Mistakes (which may exist in any code) must be found and corrected.


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