Fortran
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
C
#include <stdio.h>
#include "codata.h"
int main(void){
printf("########## EXAMPLE IN C ##########\n");
printf("%s\n","########## VERSION ##########");
printf("version = %s\n", version);
printf("%s\n","########## CONSTANTS ##########");
printf("c = %f\n", SPEED_OF_LIGHT_IN_VACUUM.value);
printf("%s\n","########## UNCERTAINTY ##########");
printf("u(c) = %f\n", SPEED_OF_LIGHT_IN_VACUUM.uncertainty);
printf("%s\n","########## OLDER VALUES ##########");
printf("Mu_2022(latest) = %23.16f\n", MOLAR_MASS_CONSTANT.value);
printf("Mu_2018 = %23.16f\n", MOLAR_MASS_CONSTANT_2018.value);
printf("Mu_2014 = %23.16f\n", MOLAR_MASS_CONSTANT_2014.value);
printf("Mu_2010 = %23.16f\n", MOLAR_MASS_CONSTANT_2010.value);
return 0;
}
Python
r"""Example in python."""
import sys
sys.path.insert(0, "../src/")
import pycodata
print("########## VERSION ##########")
print(f"version = {pycodata.__version__}")
print("########## constants ##########")
print(f"c =", pycodata.SPEED_OF_LIGHT_IN_VACUUM["value"])
print("########## UNCERTAINTY ##########")
print(f"u(c) = ", pycodata.SPEED_OF_LIGHT_IN_VACUUM["uncertainty"])
print("########## OLDER VALUES ##########")
print(f"Mu_2022 = ", pycodata.MOLAR_MASS_CONSTANT["value"])
print(f"Mu_2018 = ", pycodata.codata_constants_2018.MOLAR_MASS_CONSTANT_2018["value"])
print(f"Mu_2014 = ", pycodata.codata_constants_2014.MOLAR_MASS_CONSTANT_2014["value"])
print(f"Mu_2010 = ", pycodata.codata_constants_2010.MOLAR_MASS_CONSTANT_2010["value"])