Adding to @francescalus's response above, in my opinion, since the double precision definition can change across different platforms and compilers, it is a good practice to explicitly declare the desired kind of the constant using the standard Fortran convention, like the following example:
program test use, intrinsic :: iso_fortran_env, only: RK => real64 implicit none write(*,"(*(g20.15))") "real64: ", 2._RK / 3._RK write(*,"(*(g20.15))") "double precision: ", 2.d0 / 3.d0 write(*,"(*(g20.15))") "single precision: ", 2.e0 / 3.e0 end program test
Compiling this code with gfortran gives:
$gfortran -std=gnu *.f95 -o main $main real64: .666666666666667 double precision: .666666666666667 single precision: .666666686534882
Here, the results in the first two lines (explicit request for 64-bit real kind, and double precision kind) are the same. However, in general, this may not be the case and the double precision result could depend on the compiler flags or the hardware, whereas the real64 kind will always conform to 64-bit real kind computation, regardless of the default real kind.
Now consider another scenario where one has declared a real variable to be of kind 64-bit, however, the numerical computation is done in 32-bit precision,
program test use, intrinsic :: iso_fortran_env, only: RK => real64 implicit none real(RK) :: real_64 real_64 = 2.e0 / 3.e0 write(*,"(*(g30.15))") "32-bit accuracy is returned: ", real_64 real_64 = 2._RK / 3._RK write(*,"(*(g30.15))") "64-bit accuracy is returned: ", real_64 end program test
which gives the following output,
$gfortran -std=gnu *.f95 -o main $main 32-bit accuracy is returned: 0.666666686534882 64-bit accuracy is returned: 0.666666666666667
Even though the variable is declared as real64, the results in the first line are still wrong, in the sense that they do not conform to double precision kind (64-bit that you desire). The reason is that the computations are first done in the requested (default 32-bit) precision of the literal constants and then stored in the 64-bit variable real_64, hence, getting a different result from the more accurate answer on the second line in the output.
So the bottom-line message is: It is always a good practice to explicitly declare the kind of the literal constants in Fortran using the "underscore" convention.
DOUBLE PRECISIONnumbers with either theD0suffix or a kind parameter suffix.