FW: Setting default precision of real-valued constants to real*8 in gfortran
Laritz, Thomas
thomas.laritz@lmco.com
Mon Sep 8 17:22:00 GMT 2008
I am porting an application from the SGI MIPSpro OS to Linux/gfortran.
On Sgi MIPSpro, the default precision of real constants is real*8.
However, in gfortran, the default appears to be real*4. I have
thoroughly reviewed the gfortran and gcc literature, and have found no
way to specify use of real*8 as the default for real constants.
I have tried use of ftnchek to correct the differences on a case by case
basis. This is very tedious, however, and the results of floating point
calculations still differ after address all of the issues identified by
ftnchek.
It appears that this ability has already been contemplated. The snippet
below is from the 4.3.2 documentation:
"Proposed Extensions
Here's a list of proposed extensions for the GNU Fortran compiler, in no
particular order. Most of these are necessary to be fully compatible
with existing Fortran compilers, but they are not part of the official
J3 Fortran 95 standard.
Compiler extensions:
* User-specified alignment rules for structures.
* Flag to generate Makefile info.
* Automatically extend single precision constants to double."
I assume that the last bullet included would interpret floating point
constants as real*8 by default.
Unfortunately, I have gcc version 3.4.6 (which include gfortran 4.1.0)
installed on my systems.
Any ideas or work arounds?
More information about the Fortran
mailing list