> As ieee754 (1985):
> 
>   When the sum of two operands with opposite signs (or the
>   difference of two operands with like signs) is exactly zero,
>   the sign of that sum (or difference) shall be + in all
>   rounding modes except round toward -INFINITY, in which mode
>   that sign shall be -.

due to the emulator interface, both cases call fpisub.
i've run a number of tests on this with relatively small
numbers that are equal.  and this seems to solve the
problems without creating new ones.

- erik

; diff -c fpi.c /sys/src/9/omap
fpi.c:137,143 - /sys/src/9/omap/fpi.c:137,142
  void
  fpisub(Internal *x, Internal *y, Internal *i)
  {
-       int exact;
        Internal *t;
  
        if(y->e < x->e
fpi.c:158,164 - /sys/src/9/omap/fpi.c:157,162
                        SetInfinity(i);
                return;
        }
-       exact = x->e == y->e;
        matchexponents(x, y);
        i->e = y->e;
        i->h = y->h - x->h;
fpi.c:167,179 - /sys/src/9/omap/fpi.c:165,172
                i->l += CarryBit;
                i->h--;
        }
-       if(i->h == 0 && i->l == 0){
+       if(i->h == 0 && i->l == 0)
                SetZero(i);
- 
-               /* canceling rule */
-               if(x->s != y->s && exact)
-                       i->s = 0;       /* 1 in round to -∞ mode */
-       }
        else while(i->e > 1 && (i->h & HiddenBit) == 0)
                shift(i);
  }

Reply via email to