robin wrote:
 
DOUBLE PRECISION gives double precision on every Fortran,
and by definition is fully portable.
 
    On the other hand, real*8 is not portable.

As Dan explained, both of the above statements are misleading, at best. 

 
>integer, parameter :: dp = selected_real_kind(1.0d0)
 
>will give a syntax error.  I think you want something like:
 
I meant:
        integer, parameter :: dp = kind(1.0d0)

This is just another way to specify the kind value for  DOUBLE PRECISION.  Declarations of real(dp) are still a bad replacement for real*8.


 
Another way is to write:
 
integer, parameter :: dp = selected_real_kind(precision(1.0)+1)

Which is yet another non-improvement.   Real(dp) may very well give you a 128-bit real.  The programmer pretty clearly wanted 64-bit reals.   The following should be portable:

integer,parameter :: r8 = selected_real_kind(12,70)
real(r8) :: X

I intentionally chose 'r8' rather than 'dp' since dp suggests Double Precision which is the wrong concept to bring into this case.

Cheers,
Bill


-- 
Bill Long                                   [log in to unmask]
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120