# (j3.2006) Liaison to IFIP WG 2.5

Van Snyder van.snyder
Wed Aug 22 15:26:13 EDT 2007

```On Wed, 2007-08-22 at 12:37 -0500, Bill Long wrote:
>
>
> Van Snyder wrote:
> > On Tue, 2007-08-21 at 17:32 -0600, keith bierman wrote:
> >
> > > That's doing things naively. If you are clever you can do rafts of
> > > computation with one rounding mode, and then change the mode and do
> > > the next set. All the moreso with enough cores to be working in
> > > parallel. Of course, then it is intractable if it's just modules,
> > > hand code, and an optimizer stuck trying to paste it all back
> > > together.
> > >
> >
> > This is pretty simple for add and subtract, but for multiply there are
> > nine cases, and for divide when the divisor doesn't include zero there
> > are six.  When the divisor includes zero you just produce NaN (or should
> > it be [-Inf,+Inf]?).  So for multiply you'd set the rounding mode down
> > and then execute a 9-way where/elsewhere block, then set it up and
> > execute another where/elsewhere block.
> What algorithm are you using?  From Wikipedia, I see this for interval
> multiplies:
>
> [a,b] ? [c,d] = [min (ac, ad, bc, bd), max (ac, ad, bc, bd)]
>
>
> This looks like 4 multiplies rounded up, another 4 multiplies (same
> operands) rounded down, and 6 conditional merges.  No reasonable use
> of where/elsewhere blocks in sight.

That's fine if you want to do four multiplies instead of two in all but
one case.

Table 1 from Kulisch's book:

----------------------------------------------------------------------
A = [a1,a2],   B = [b1,b2]    A*B
----------------------------------------------------------------------
1   a1 >= 0        b1 >= 0        [a1b1,a2b2]
2   a1 >= 0        b2 <= 0        [a2b1,a1b2]
3   a1 >= 0        b1 < 0 < b2    [a2b1,a2b2]
4   a2 <= 0        b1 >= 0        [a1b2,a2b1]
5   a2 <= 0        b2 <= 0        [a2b2,a1b1]
6   a2 <= 0        b1 < 0 < b2    [a1b2,a1b1]
7   a1 < 0 < a2    b1 >= 0        [a1b2,a2b2]
8   a1 < 0 < a2    b2 <= 0        [a2b1,a1b1]
9   a1 < 0 < a2    b1 < 0 < b2    [min(a1b2,a2b1),max(a1b1,a2b2)]
---------------------------------------------------------------------

```