[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: tininess detection emulation -- before/after rounding
Hi Michel,
The lesson I draw from your analysis is that it seems significantly
harder to emulate "after rounding" on a "before rounding" machine than
vice versa, because one potentially needs to cover up exceptions rather
than raise them. This sounds entirely reasonable, and consistent with
Guillaume's observation that "after rounding" gives fewer false
positives. (And "after rounding" with an "unequal" rather than a "tiny"
test gives fewer still, arguably none, so it's a pity that even the
possibility of such an implementation has just been eliminated.) Of
course, the practical conclusions one draws from this are arguable.
| On x86, the issue is different. If operands are guaranteed to
| remain in the standard format range (including subnormal precision
| when applicable), after-rounding tininess detection already works
| as desired. I'm told this was a very big IF however, requiring
| storing and reloading operands after or before every operation,
| because the bounded-precision setting does not in itself lead to
| denormalisation. Somebody else would have to fill in the details,
| but I suspect that there is a performance penalty somewhere.
These days, one needs to distinguish different implementations of
floating-point operations available in most x86 processors. The issues
you identify here apply to the x87-style FP stack where extended
exponent range (and optionally, precision) is used for intermediate
results. The SSE2 instructions, however, give a more traditional model
of double-precision computation. Thus, by forcing the use of SSE2
instructions one should obtain the "reproducible" behaviour as far as
I can see. This can generally be done by compiler options, e.g.
something like "-msse2 -mfpmath=sse" on gcc.
John.