Setting default precision of real-valued constants to real*8 in gfortran

Dennis Wassel dennis.wassel@googlemail.com
Mon Sep 8 19:03:00 GMT 2008


2008/9/8 Laritz, Thomas <thomas.laritz@lmco.com>:
>
>  [snip]
>
> 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?
>

Hi Thomas,

judging from what I have read on this list and my own experience, you
should consider upgrading your compiler to -at least- gfortran 4.2,
because the 4.1s apparently still have serious flaws. That said, if
you upgrade anyway you'll want to take the latest version (4.3.2) that
is available from gcc.gnu.org.

[d'oh, Tobias was faster here...]

Still, you mentioned floating point *constants*, and those are a whole
different story:
REAL, PARAMETER :: pi = 3.141592653589793 is not going to benefit from
additional precision by -fdefault-real-8, unless you add the "_8"
suffix to promote the numerical constant itself to double precision.
This is also valid if your existing code uses F77-style
PARAMETER(PI=3.141592653589793) statements instead.

Cheers,
Dennis



More information about the Fortran mailing list