Interval arithmetic

Andrew J Bromage ajb@spamcop.net
Thu, 28 Aug 2003 10:40:59 +1000


G'day all.

On Wed, Aug 27, 2003 at 04:03:52PM +0000, Jonas Ritter wrote:

> >+ :: Intervall -> Intervall -> Intervall
> >(a,b) + (c,d) = (a+c,b+d)

In general this is insufficient because of floating point rounding.

The "standard" IEEE 754 rounding rule is the floating point equivalent
of rounding to the nearest whole number, and in the case of the
fractional part being exactly 0.5, rounding to the nearest _even_
whole number.  For interval arithmetic, however, you always want the
first operation to round down and the second operation to round up.
This requires manipulating the state of the FPU, and it's not obvious
how to specify this in a language like Haskell.

In addition, it may be hard to implement on existing multi-threading
run-time systems.  To be semantically correct, the FPU state has to
be stored across user threads, which may not be in a 1:1 correspondence
with OS threads.

Cheers,
Andrew Bromage