I generally use this form to get double precision in my Fortran code:
use, intrinsic :: ISO_FORTRAN_ENV
real(kind=real64) :: a = 5d0
However, when defining several variables in a row, real(kind=real64)
gets very repetitive. It's tempting to just use real*8
, although I've avoided doing so because I've been taught that, although unlikely, it has the potential to make the program non-portable.
From another question I found on the subject I see that real(real64)
works, but I don't know if this is good practice; it seems to be the same as using real(8)
since, at least on my system, real64 = 8. Is there a shorter way than real(kind=real64)
to specify a kind in a variable declaration? Is there even a realistic chance of real*8
causing problems?