J3/97-175r1
Date: May 13, 1997
To: J3
From: Interval 1
Subject: Justification for interval intrinsic operators
Reference: J3 / 97-173
The issue of whether all of the proposed binary operators particular
to interval arithmetic are needed has been raised. It has been
argued that such operators, such as .DJ. (or .DISJOINT.) are not
needed, since they can be expressed in terms of comparisons
(with floating point .LT., .GT., .LE., and .GE.) on the end points
of the interval operands. It is our contention, however, that
naive user implementations of such operators will most likely
be wrong for many exceptional cases, and thus, significant value
is added by support within the language.
As an example, consider X .DJ. Y, where X = [xl,xu] and Y = [yl,yu],
on an IEEE 754 compliant processor. Then X .DJ. Y is
defined to be .TRUE. provided xl > yu or xu < yl. However,
suppose .DJ. is implemented directly according to this
definition, suppose X is an ordinary interval, and suppose
Y = [NaN,NaN]. Then xl > NaN compares to .FALSE. and xu < NaN
compares to .FALSE., so X .DJ. Y evaluates to .TRUE. !?!
An implementation of .DJ. that handles this case correctly is:
X.DJ.Y .EQUIV.
.NOT. ( (xl<=yu) .AND. (yl<=xu) .AND. (xl<=xu) .AND. (yl<=yu) )
Nonetheless, applying De Morgan's rule to this, namely
(xl>yu) .OR. (yl>xu) .OR. (xl>xu) .OR. (yl>yu)
does not give the correct result when one of X or Y is [NaN,NaN].
Leaving discovery of such problems and expressions to the user
poses a significant extra risk of lost user productivity and of
incorrect results.