Ulrich Weigand <[EMAIL PROTECTED]> wrote:

> Dave Rivers wrote:

> >That is, of course one of the issues.  The i386 IEEE implementation
> >is not the same as the mainframe, particularly when two variables
> >are loaded into registers and arithmetic is applied.  The result
> >will be different.    So, one set of "IEEE" arithmetic on a PC
> >can get very different answers than the same arithmetic on a 390.
> >I don't know how gcc handles this.

> Basically, by not using the host's native floating point facilities
> at all.  Instead, all floating point use at compile time is done by
> a floating point emulation library that can be tuned to exactly
> simulate the target's native floating point format and precision.

> This is necessary both for things like compile-time folding of
> floating point constants, to make sure we get the same result
> as we'd get had we executed the computation explicitly on the
> target machine, and for things like the use of floating point
> variables internally to the compiler (e.g. for branch probabilities)
> where different rounding could cause different optimization
> decisions and thus different emitted code in a cross vs. a
> native compilation.

You can lose here, too.  When the Pentium divide bug came out,
everyone was compiling a test program to see if they had the bug.
The test program evaluated a constant expression, which some compilers
did without using the host.  You can't test the host floating point
without using it!

Yes, there are differences due to using extended precision (80 bit)
registers on Intel (and, I think 680x0).  That is part of IEEE, and
anyone who writes programs that depend on that deserve what they get.

-- glen

Reply via email to