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.
- Prev by Date: Re: Help for a FORTRAN N00b
- Next by Date: Re: Help for a FORTRAN N00b
- Previous by thread: Can "Microsoft Visual Studio .NET 2003" hide the code of Fortran?
- Next by thread: Re: Commutative law in addition in XL Fortran