Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

decimal accuracy

Susan_Frankenstein
418 Views
The following code produces different output depending on the compiler:
Tref = 273.15d0
write(*,*) Tref
With the intel fortran compiler I get 273.150000000000
With PGI, Absoft, GNU I get 273.149999999999
Intel compiler options:
FFLAGS1 = -stand f03 -free -check all -r8 -shared-intel -heap-arrays -m64 -fpe3 -c
GNU compiler options:
FFLAGS1 = -std=f2003 -ffree-form -fcheck=all -fdefault-real-8 -fdefault-double-8 -m64 -fall-intrinsics -c
Differences like these eventually cause the program results to diverge. Thoughts on how I can make the intel results match the others?
0 Kudos
1 Reply
TimP
Honored Contributor III
418 Views
The difference you are showing is not at all conclusive. If you are writing out list-directed files and reading them back, you should avoid writing formatted data, or at least use a wide enough format (17 digits precision is sufficient).
For consistency with gfortran, your ifort options should include -fp-model source or the following string: -assume protect_parens -prec-div -prec-sqrt -no-ftz.
If your gfortran is 32-bit, you might add -pc80 -mia32 to your ifort options, if you don't wish to add -march=pentium4 to your gfortran options.
Whether you intended it or not, your gfortran options imply -O0, while your ifort options imply -O2, which resembles gfortran -O3. That also will affect your numerics as well as performance.
0 Kudos
Reply