Re: is real*8 a standard declaration style?



On 30/10/2011 1:59 a.m., Daniel Carrera wrote:

It is not standard. It is an extension to Fortran 77 which happened to
be adopted fairly universally, but not consistently. In other words,
"REAL*8" is can mean different things in different compilers.

With modern Fortran you should use the "KIND" parameter, and the
selected_real_kind() variable. Like this:


integer, parameter :: double = selected_real_kind(12)

This will give you a REAL kind with at least 12 digits of precision. You
can then use it in your program with:

real(kind=double) :: foo

The "kind" parameter can be omitted, so if you prefer you can write:

real(double) :: foo


In some compilers, "double" will be 8, and in other compilers it will be
something else,

In my working life I've never met a compiler for which it is something else, and I'm pretty confident that in what remains of it I will never meet one.
.



Relevant Pages

  • Re: subroutines as arguments
    ... That would be the case where bar never ended up invoking the subroutine ... ends up invoking foo. ... Compilers are not required to catch illegal recursive calls. ... allow recursion at all. ...
    (comp.lang.fortran)
  • Re: How can this program even compile and run?
    ... about foo() to tell it what the signature of foo, ... there are some compilers that will notice the problem as ... recommendation on coding choices. ... things that require an explicit interface to work correctly. ...
    (comp.lang.fortran)
  • Re: Preprocessor problem
    ... LIST_TYPE*foo; ... In any case you'd have to use a prefix and not a suffix, ... A macro that expands an inline functions would fit better, ... Otherwise nowadays it is neither a problem for compilers nor ...
    (comp.lang.c)
  • Re: subroutines as arguments
    ... That would be the case where bar never ended up invoking the subroutine ... ends up invoking foo. ... compilers might have extensions that allow nonstandard recursive calls. ... allow recursion at all. ...
    (comp.lang.fortran)
  • Re: unresolved unreferenced external procedures
    ... >> context you're processing in doesn't have a program unit named FOO, ... That's likely what most compilers will do. ... block data can be named. ...
    (comp.lang.fortran)