>>>>> "Richard" == Richard Fateman <fateman at cs.berkeley.edu> writes:
Richard> Directed rounding is not needed for rationals. It is
Richard> needed for floats, otherwise you lose the inclusion
Richard> property for interval arithmetic, and you can no longer
Richard> make the strong claims about the interval result
Richard> containing the actual answer.
Yeah, I was lazy. Plus, I wasn't sure how to do directed rounding
when you mix a single-float with a double-float.
>> What is the result? [-eps, eps], where eps is a floating-point
>> precision of some sort?
>>
Richard> No, interval(-1, 1) - interval(-1,1) means { x-y | x is in
Richard> [-1,1], and y is in [-1,1]}
Richard> The smallest value in this set is when x=-1, y=1: -1 - 1 = -2.
Richard> The largest value is when x=1, y=-1: 1 - (-1) or 2. So
Richard> interval(-1,1) - interval(-1,1) --> interval(-2,2).
Richard> One could try to make a distinction between two intervals that
Richard> coincidentally
Richard> have the same endpoints, or two pointers to the same interval. In the latter
Richard> case, one could argue that x and y are not independently chosen from [-1,1]
Richard> but are the same. then the set is {x-x | ....} and is {0}.
Yes, that's how I was interpreting x-x, not x - y where x and y happen
to be the same interval and independent.
Richard> I suppose one could view every variable as an interval, and the
Richard> ones we have been using so far are the intervals with zero width, and
Richard> try to make sense of it all. It works if all the arithmetic is done on
Richard> explicit intervals. If we introduce symbols and do arithmetic like
Richard> x-y , or x-x, or x/x, or is (x=x) then there is trouble.
Richard> Oh, x-x --> 0 is also false for IEEE float NaN, Inf, too.
Yep. CMUCL more or less ignores the issue with NaN and Inf in these
cases.
Ray