[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stds-754] Radical solutions to global flags



Michel Hack (1-914-784-7648) <hack@xxxxxxxxxxxxxx> wrote:

I thought your earlier suggestion of an Inexact indication in the result
would cover most of the issues, at the cost of only one bit, and almost
transparent if the low-order significand bit is picked.  (This would not
work for DFP, unless we give up an entire digit.)  But now I wonder...

No, I am afraid that it doesn't, not if you want to allow zero to be
signed.  I went through the same thoughts as you at one stage, and
came to the same conclusion.  Basically, there are several reasonably
consistent combinations:

a) A single, possibly approximate, zero (i.e. traditional)
b) An approximate zero and negative and positive infinitesimals
c) (b) plus a true zero
d) 3 flag bits, allowing for all of the 7 combinations of positive,
negative and true zero (approximate sets all 3 bits).

Inexact is semi-orthogonal to that, because the inverse of a true
positive infinity could be an exact positive infinitesimal.

The inverse of only infinitesimals with a known sign would be infinity;
all others would be NaN.

Problems remain, however.  What is the sign of x-x when x is finite
but inexact?  (The arithmetic won't know whether the two operands are
the same variable, or two variables with the same inexact significand.)
Would a NaN be acceptable here?

For the sign, unquestionably.  That is what Fortran compilers did for
years, and it caused the authors of buggy programs to complain, but
the numerical advisers were very happy with the situation.

Indeed, even with multiple flags, the combining rules could be
problematic.  It might be a slippery slope towards a parody of
interval arithmetic.

Without care, that is true.  I believe that, with care, one could
produce something that would have all the flexibility of IEEE 754
and the safety of traditional, checked arithmetic.  One can't stop
people shooting themselves in the foot, but one CAN provide trigger
guards, safety catches and the ability to unload without firing the
gun!

But not with the existing format :-(


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1@xxxxxxxxx
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

754 | revision | FAQ | references | list archive