The following is more or less, my go-to module that I use it everywhere:
module mod_types
use iso_fortran_env, only: int8, int16, int32, int64, real32, real64, &
input_unit, output_unit, error_unit
implicit none
integer, parameter :: sp = real32
integer, parameter :: dp = real64
integer, parameter :: stdin = input_unit
integer, parameter :: stdout = output_unit
integer, parameter :: stderr = error_unit
end module
An example use is:
module foo
use mod_types, only: wp=>dp
implicit none
real(wp)::bar
end module
wp
stands for working precision and if for some reason I want to change precision, I just change this wp=>sp
so I do not need to change manually all real
variables. I believe something in that line is considered the “standard way” now.