Re: Commutative law in addition in XL Fortran



insun.song@xxxxxxxxx wrote:
On May 11, 3:41 am, "Michael Metcalf" <michaelmetc...@xxxxxxxxxxxxxx>
wrote:
That's a big subject, but think about

A + a - B
and
A - B + a

where A, B >>>> a
and A ~ B
and A, B, a > 0

Regards,

Mike Metcalf

In this case, however, the order of magnitude of 4 numbers is similar
to
each other.

Yes. They're off by a bit more than a factor of 4 -- that is, 2**2. Thus, one would expect to find variation in the last one or two bits.

And, indeed, the differences you're complaining of are about the size one would expect from changing the last one or two bits.

By the way, if I test the program I mentioned above in Linux machine
using
Intel fortran (or g95), and if I use the following numbers of which
the last
three digits are removed (or rounded up),

a = 0.378662378978239E-11_r8
b = 0.103523081746141E-10_r8
c = 0.880061250413881E-11_r8
d = -0.713532278734606E-10_r8

Results do not depend on the order of adding.....

That's probably because on i686, intermediate results are usually put into extra-precision (80-bit) registers, so you don't get any signficant rounding until the result is stored in memory.

- Brooks


--
The "bmoses-nospam" address is valid; no unmunging needed.
.