The modules:
are automatically generated with a simple parser written in Python.
The latest codata constants were released in 2022 by the NIST. All values for the codata constants are provided as double precision reals in a derived type codata_constant_type. The names are quite long and can be aliased with shorter names. A module level interface to_real is available for getting the constant value or uncertainty of a constant.
program example_in_f
use iso_fortran_env
use codata
implicit none
print '(A)', '########## EXAMPLE IN FORTRAN ##########'
print '(A)', '########## VERSION ##########'
print *, "version = ", get_version()
print '(A)', '########## CONSTANTS ##########'
print *, "c = ", SPEED_OF_LIGHT_IN_VACUUM%value
print '(A)', '########## UNCERTAINTY ##########'
print *, "u(c) = ", SPEED_OF_LIGHT_IN_VACUUM%uncertainty
print '(A)', '########## OLDER VALUES ##########'
print '(A, F23.16)', "Mu_2022(latest) = ", MOLAR_MASS_CONSTANT%value
print '(A, F23.16)', "Mu_2018 = ", MOLAR_MASS_CONSTANT_2018%value
print '(A, F23.16)', "Mu_2014 = ", MOLAR_MASS_CONSTANT_2014%value
print '(A, F23.16)', "Mu_2010 = ", MOLAR_MASS_CONSTANT_2010%value
end program