Boost logo

Boost :

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


>>> Now see:
>>>
>>> [-1.0, 1.0] / .0
>>>
>>> What is the correct result? Of course, [-inf, inf]
>>
>> The way I understand interval arithmetics, the result is the set
>> {x / 0 for all x in [-1, 1]}.
>>
>> Now, x/0 is undefined for all x in [-1, 1], so returning an empty set seems
>> logical to me.
>
>For IEEE double, 1./0 is well defined as +inf, and -1./0 as -inf, so I
>agree that returning an empty set (apparently creating an empty set
>throws, with the default policy) is questionable, it depends on your
>application whether you want empty or [-inf,+inf]. I did not check if
>boost provides a policy to change that behavior.

The problem is 0 between -1 and 1. For IEEE floats, .0 / .0 is NaN. If not this special 0, the result could be [-inf, inf]. That was my mistake.

But IEEE Interval Arithmetic Working Group also propose empty set as only possible result of / [0, 0] operation. So, full accordance here.

Some conflict is possible with .0 / .0 is NaN C++ conception (as if it were main idea, result interval would be NaN), but it seems to be standard mathematical practice to set this to empty.


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