# Commutative law in addition in XL Fortran

To group members with more expertise,

I have been experiencing somewhat strange problems
in doing a simple sum of double precision real variables
in my program.

The following is a part of the program that simply adds
four double precision numbers. The program has been
compiled using XL Fortran 9.1 on IBM e-server without
using any compilation options

integer, parameter :: r8 = selected_real_kind(12)
real(r8) :: a,b,c,d,e,f

a = 0.378662378978238886E-11_r8
b = 0.103523081746141482E-10_r8
c = 0.880061250413881054E-11_r8
d = -0.713532278734606307E-10_r8

e = a+b+c+d
f = a+d+b+c

In this calculation, "e" and "f" become as follows:
e = -0.484136834049252831E-10,
f = -0.484136834049252895E-10.

The last two digits are different between "e" and "f".

Have you ever experience this problem?
Is this problem related to the extended number of significant
digit in XL Fortran? How can I remove this behavior without
using compilation option like "-qfloat=ieee". I think it's better
not to use "-qfloat=ieee" because my program should be
inserted as a part of much bigger program (Global atmospheric
model) that is not compiled with such an option.

.

## Relevant Pages

• Re: Commutative law in addition in XL Fortran
... in doing a simple sum of double precision real variables ... compiled using XL Fortran 9.1 on IBM e-server without ... using any compilation options ... I think the commutative law in addition should hold in this ...
(comp.lang.fortran)
• Re: Commutative law in addition in XL Fortran
... in doing a simple sum of double precision real variables ... using any compilation options ... I think the commutative law in addition should hold in this ... according to the Fortran standard the compiler is free to ...
(comp.lang.fortran)
• Re: ULE/yielding patch for testing.
... but still a slightly higher than on 6.X, but I'm still experiencing ... slowdown of webpage rendering during compilation. ...
(freebsd-current)