So, the benefit of the KIND is the portability across different compilers and, therefore, systems? I know that my double precisions ARE double precisions using KIND, rather than assuming the compiler is applying the definition effectively?
If so, how big an issue is this?
My ‘concern’ is that this appears to add a little more confusion to the code, albeit tiny in most cases (if I am correct on its usage).
One of the functions I now have is this one…
double precision function radnab(kappa, luminosity, totalPressure, gfs, mass, temperature)
use stellar_values, only: PI, SIGMA
implicit none
double precision, intent(in) :: kappa, luminosity, totalPressure, gfs, mass, temperature
save
radnab = (3d0 * 10.0**kappa * luminosity * totalPressure) / (6.4d1 * gfs * PI * SIGMA * mass * temperature**4)
return
end function radnab
I am assuming that I would gain the same accuracy, but better portability, if I did this?
double precision function radnab(kappa, luminosity, totalPressure, gfs, mass, temperature)
use stellar_values, only: PI, SIGMA
implicit none
double precision, intent(in) :: kappa, luminosity, totalPressure, gfs, mass, temperature
integer, parameter :: DP = kind(0d0)
double precision(kind = DP) :: d
save
radnab = (3.0_d * 10.0**kappa * luminosity * totalPressure) / (64.0 * gfs * PI * SIGMA * mass * temperature**4)
return
end function radnab
Am I understanding this correctly, @RonShepard ?