Skip to main content

Module constants

Module constants 

Source
Expand description

121 mathematical, physical, and cryptographic constants as compile-time const values. The const values are always available, even in no_std. The runtime Constants lookup API and ConstantValue enum require the std feature.

Structs§

Constantstd
A single named constant with its string-encoded value. Requires the std feature.
Constantsstd
Collection of 121 mathematical, physical, and cryptographic constants. Requires the std feature.

Enums§

Category
Constant category for CONSTANTS_TABLE.
ConstantValuestd
Enum to represent the different constant values. Requires the std feature.

Constants§

ALPHA_PARTICLE_MASS
Alpha particle mass (CODATA 2018). m_α ≈ 6.6446573357e-27 kg
APERY
Apéry’s constant, which is the sum of the reciprocals of the positive cubes. ζ(3) ≈ 1.2020569032
ATOMIC_MASS_UNIT
The unified atomic mass unit / dalton (CODATA 2018). u ≈ 1.66053906660 x 10^-27 kg
ATOMIC_MASS_UNIT_UNCERTAINTY
Standard uncertainty of ATOMIC_MASS_UNIT. Source: CODATA 2018.
ATOMIC_UNIT_OF_ELECTRIC_FIELD
Atomic unit of electric field. E_h/(ea_0) ≈ 5.14220674763e11 V/m
ATOMIC_UNIT_OF_FORCE
Atomic unit of force. E_h/a_0 ≈ 8.2387234983e-8 N
ATOMIC_UNIT_OF_LENGTH
Atomic unit of length (= Bohr radius). a_0 ≈ 5.29177210903e-11 m
ATOMIC_UNIT_OF_POLARIZABILITY
Atomic unit of electric polarizability. e²a₀²/E_h ≈ 1.64877727436e-41 C²m²/J
ATOMIC_UNIT_OF_TIME
Atomic unit of time. ℏ/E_h ≈ 2.4188843265857e-17 s
ATOMIC_UNIT_OF_VELOCITY
Atomic unit of velocity. a_0 E_h/ℏ ≈ 2.18769126364e6 m/s
AVOGADRO
Avogadro’s constant (CODATA 2018, exact since 2019 SI). N_A = 6.02214076 x 10^23 mol^-1
BOHR_MAGNETON
Bohr magneton (CODATA 2018). μ_B = eℏ/(2m_e) ≈ 9.2740100783e-24 J/T
BOHR_RADIUS
The Bohr radius (CODATA 2018). a_0 ≈ 5.29177210903 x 10^-11 m
BOHR_RADIUS_UNCERTAINTY
Standard uncertainty of BOHR_RADIUS. Source: CODATA 2018.
BOLTZMANN
Boltzmann’s constant (CODATA 2018, exact since 2019 SI). k_B = 1.380649 x 10^-23 J K^-1
CATALAN
Catalan’s constant, which is the sum of the alternating harmonic series. C ≈ 0.915965594177219
CLASSICAL_ELECTRON_RADIUS
Classical electron radius (CODATA 2018). r_e = α²a_0 ≈ 2.8179403262e-15 m
CONDUCTANCE_QUANTUM
The conductance quantum (CODATA 2018, exact since 2019 SI). G_0 = 2e²/h = 7.748091729 x 10^-5 S
CONSTANTS_TABLE
A static lookup table of all named float constants.
COULOMB
Coulomb’s constant (CODATA 2018). k_e ≈ 8.9875517923 x 10^9 N m^2 C^-2
COULOMB_UNCERTAINTY
Standard uncertainty of COULOMB. Source: CODATA 2018.
DEUTERON_MASS
Deuteron mass (CODATA 2018). m_d ≈ 3.3435837724e-27 kg
DEUTERON_PROTON_MASS_RATIO
Deuteron-to-proton mass ratio (CODATA 2018). m_d / m_p ≈ 1.99900750139
ELECTRON_CHARGE_TO_MASS
Electron charge-to-mass quotient (CODATA 2018). e/m_e ≈ -1.75882001076e11 C/kg
ELECTRON_COMPTON_WAVELENGTH
Compton wavelength of the electron (CODATA 2018). λ_C = h/(m_e c) ≈ 2.42631023867e-12 m
ELECTRON_G_FACTOR
Electron g-factor (CODATA 2018). g_e ≈ -2.00231930436256
ELECTRON_MAGNETIC_MOMENT
Electron magnetic moment (CODATA 2018). μ_e ≈ -9.2847647043e-24 J/T
ELECTRON_MASS
The rest mass of an electron (CODATA 2018). m_e ≈ 9.1093837015 x 10^-31 kg
ELECTRON_MASS_MEV
Electron mass in MeV/c² (CODATA 2018). m_e c² ≈ 0.51099895000 MeV
ELECTRON_MASS_UNCERTAINTY
Standard uncertainty of ELECTRON_MASS. Source: CODATA 2018.
ELECTRON_PROTON_MASS_RATIO
Electron-to-proton mass ratio (CODATA 2018). m_e / m_p ≈ 5.44617021487e-4
ELECTRON_REDUCED_COMPTON
Reduced Compton wavelength of the electron. λ̄_e = ℏ/(m_e c) ≈ 3.8615926796e-13 m
ELECTRON_VOLT
Electron volt in joules (CODATA 2018, exact). 1 eV = 1.602176634e-19 J
ELEMENTARY_CHARGE
The elementary charge (CODATA 2018, exact since 2019 SI). e = 1.602176634 x 10^-19 C
EULER
The base of the natural logarithm, Euler’s number. e ≈ 2.7182818284590452353602874713527
EV_TO_AMU
Electron volt–atomic mass unit relationship. 1 eV/c² ≈ 1.07354410233e-9 u
EV_TO_HZ
Electron volt–hertz relationship (exact). 1 eV/h ≈ 2.417989242e14 Hz
EV_TO_INVERSE_METER
Electron volt–inverse meter relationship (exact). 1 eV/(hc) ≈ 8.065543937e5 /m
EV_TO_KELVIN
Electron volt–kelvin relationship (exact). 1 eV/k_B ≈ 1.160451812e4 K
EV_TO_KG
Electron volt–kilogram relationship (exact). 1 eV/c² ≈ 1.782661921e-36 kg
FARADAY
Faraday constant (CODATA 2018, exact since 2019 SI). F = N_A * e = 96485.33212 C mol^-1
FINE_STRUCTURE
The fine-structure constant (CODATA 2018). α ≈ 7.2973525693 x 10^-3 (dimensionless)
FINE_STRUCTURE_UNCERTAINTY
Standard uncertainty of FINE_STRUCTURE. Source: CODATA 2018.
FIRST_RADIATION_CONSTANT
First radiation constant (CODATA 2018). c_1 = 2πhc² ≈ 3.741771852e-16 W m²
FRAC_1_PI
The reciprocal of pi. 1/π ≈ 0.3183098861837907
FRAC_1_SQRT_2
The reciprocal of the square root of 2. 1/√2 ≈ 0.7071067811865476
FRAC_2_PI
Two divided by pi. 2/π ≈ 0.6366197723675814
FRAC_2_SQRT_PI
Two divided by the square root of pi. 2/√π ≈ 1.1283791670955126
FRAC_PI_2
Pi divided by 2 (a right angle in radians). π/2 ≈ 1.5707963267948966
FRAC_PI_3
Pi divided by 3 (60 degrees in radians). π/3 ≈ 1.0471975511965979
FRAC_PI_4
Pi divided by 4 (45 degrees in radians). π/4 ≈ 0.7853981633974483
FRAC_PI_6
Pi divided by 6 (30 degrees in radians). π/6 ≈ 0.5235987755982989
FRAC_PI_8
Pi divided by 8 (22.5 degrees in radians). π/8 ≈ 0.39269908169872414
GAMMA
The Euler-Mascheroni constant, which is the limiting difference between the harmonic series and the natural logarithm. γ ≈ 0.5772156649015329
GAS_CONSTANT
The molar gas constant (CODATA 2018, exact since 2019 SI). R = N_A * k_B = 8.314462618 J mol^-1 K^-1
GAS_CONSTANT_L_ATM
Molar gas constant in L·atm/(mol·K). R ≈ 0.08205736608 L·atm/(mol·K)
GLAISHER_KINKELIN
Glaisher-Kinkelin constant, which arises in the asymptotic expansion of the Barnes G-function. A ≈ 1.2824271291
GRAVITATIONAL_CONSTANT
The Newtonian gravitational constant (CODATA 2018). G ≈ 6.67430 x 10^-11 m^3 kg^-1 s^-2
GRAVITATIONAL_CONSTANT_UNCERTAINTY
Standard uncertainty of GRAVITATIONAL_CONSTANT. Source: CODATA 2018.
HARTREE_ENERGY
Hartree energy (CODATA 2018). E_h = m_e c² α² ≈ 4.3597447222071e-18 J
HARTREE_ENERGY_EV
Hartree energy in eV (CODATA 2018). E_h ≈ 27.211386245988 eV
HASH_ALGORITHM
The hash algorithm used. The default is Blake3.
HASH_COST
The cost of the hash algorithm. The default is 8.
HASH_LENGTH
The hash length is the length of the hash in bytes.
HELION_MASS
Helion (He-3 nucleus) mass (CODATA 2018). m_h ≈ 5.0064127796e-27 kg
HIGGS_BOSON_MASS_GEV
Higgs boson mass (PDG 2022). m_H ≈ 125.25 GeV/c²
IMPEDANCE_OF_FREE_SPACE
Impedance of free space (CODATA 2018). Z_0 = μ₀c ≈ 376.730313668 Ω
INVERSE_FINE_STRUCTURE
Inverse fine-structure constant (CODATA 2018). 1/α ≈ 137.035999084
JOSEPHSON_CONSTANT
Josephson constant (CODATA 2018, exact since 2019 SI). K_J = 2e/h ≈ 4.835978484e14 Hz/V
KHINCHIN
Khinchin’s constant, which appears in the theory of continued fractions. K ≈ 2.6854520010
LN_2
The natural logarithm of 2. ln(2) ≈ 0.6931471805599453
LN_10
The natural logarithm of 10. ln(10) ≈ 2.302585092994046
LOG2_E
The base-2 logarithm of Euler’s number. log₂(e) ≈ 1.4426950408889634
LOG10_E
The base-10 logarithm of Euler’s number. log₁₀(e) ≈ 0.4342944819032518
LOSCHMIDT_CONSTANT
Loschmidt constant at 273.15 K, 101.325 kPa. n_0 ≈ 2.6867774e25 /m³
MAGNETIC_FLUX_QUANTUM
The magnetic flux quantum (CODATA 2018, exact since 2019 SI). Φ_0 = h/(2e) = 2.067833848 x 10^-15 Wb
MOLAR_MASS_CONSTANT
Molar mass constant (CODATA 2018). M_u ≈ 0.99999999965e-3 kg/mol
MOLAR_PLANCK_CONSTANT
Molar Planck constant (exact). N_A h ≈ 3.990312712e-10 J s/mol
MOLAR_VOLUME_IDEAL_GAS
Molar volume of ideal gas at STP (273.15 K, 100 kPa). V_m ≈ 22.71095e-3 m³/mol
MUON_ELECTRON_MASS_RATIO
Muon-to-electron mass ratio (CODATA 2018). m_μ / m_e ≈ 206.7682830
MUON_MASS
Muon mass (CODATA 2018). m_μ ≈ 1.883531627e-28 kg
MUON_MASS_MEV
Muon mass in MeV/c² (CODATA 2018). m_μ c² ≈ 105.6583755 MeV
NEUTRON_COMPTON_WAVELENGTH
Compton wavelength of the neutron (CODATA 2018). λ_C,n = h/(m_n c) ≈ 1.31959090581e-15 m
NEUTRON_MAGNETIC_MOMENT
Neutron magnetic moment (CODATA 2018). μ_n ≈ -9.6623651e-27 J/T
NEUTRON_MASS
The rest mass of a neutron (CODATA 2018). m_n ≈ 1.67492749804 x 10^-27 kg
NEUTRON_MASS_MEV
Neutron mass in MeV/c² (CODATA 2018). m_n c² ≈ 939.56542052 MeV
NEUTRON_MASS_UNCERTAINTY
Standard uncertainty of NEUTRON_MASS. Source: CODATA 2018.
NEUTRON_PROTON_MASS_RATIO
Neutron-to-proton mass ratio (CODATA 2018). m_n / m_p ≈ 1.00137841931
NEUTRON_REDUCED_COMPTON
Reduced Compton wavelength of the neutron. λ̄_n = ℏ/(m_n c) ≈ 2.10019415600e-16 m
NUCLEAR_MAGNETON
Nuclear magneton (CODATA 2018). μ_N = eℏ/(2m_p) ≈ 5.0507837461e-27 J/T
PHI
The golden ratio, which is the limit of the ratio of consecutive Fibonacci numbers. φ = (1 + √5) / 2 ≈ 1.6180339887498948482045868343656
PI
The ratio of a circle’s circumference to its diameter. π ≈ 3.14159265358979323846264338327950288
PLANCK
Planck’s constant (CODATA 2018, exact since 2019 SI). h = 6.62607015 x 10^-34 J s
PLANCK_CHARGE
Planck charge. q_P = √(4πε₀ℏc) ≈ 1.875546e-18 C
PLANCK_LENGTH
Planck length. l_P = √(ℏG/c³) ≈ 1.616255e-35 m
PLANCK_MASS
Planck mass. m_P = √(ℏc/G) ≈ 2.176434e-8 kg
PLANCK_REDUCED
Planck’s reduced constant, which is Planck’s constant divided by 2π. ħ = h / (2π) ≈ 1.054571817 x 10^-34 J s
PLANCK_TEMPERATURE
Planck temperature. T_P = m_P c²/k_B ≈ 1.416784e32 K
PLANCK_TIME
Planck time. t_P = √(ℏG/c⁵) ≈ 5.391247e-44 s
PROTON_CHARGE_TO_MASS
Proton charge-to-mass quotient (CODATA 2018). e/m_p ≈ 9.5788332e7 C/kg
PROTON_COMPTON_WAVELENGTH
Compton wavelength of the proton (CODATA 2018). λ_C,p = h/(m_p c) ≈ 1.32140985539e-15 m
PROTON_ELECTRON_MASS_RATIO
Proton-to-electron mass ratio (CODATA 2018). m_p / m_e ≈ 1836.15267343
PROTON_G_FACTOR
Proton g-factor (CODATA 2018). g_p ≈ 5.5856946893
PROTON_MAGNETIC_MOMENT
Proton magnetic moment (CODATA 2018). μ_p ≈ 1.41060679736e-26 J/T
PROTON_MASS
The rest mass of a proton (CODATA 2018). m_p ≈ 1.67262192369 x 10^-27 kg
PROTON_MASS_MEV
Proton mass in MeV/c² (CODATA 2018). m_p c² ≈ 938.27208816 MeV
PROTON_MASS_UNCERTAINTY
Standard uncertainty of PROTON_MASS. Source: CODATA 2018.
PROTON_REDUCED_COMPTON
Reduced Compton wavelength of the proton. λ̄_p = ℏ/(m_p c) ≈ 2.10308910336e-16 m
RYDBERG
The Rydberg constant (CODATA 2018). R∞ ≈ 10973731.568160 m^-1
RYDBERG_UNCERTAINTY
Standard uncertainty of RYDBERG. Source: CODATA 2018.
SACKUR_TETRODE_CONSTANT
Sackur-Tetrode constant at 1 K, 101.325 kPa. S_0/R ≈ -1.15170753706
SECOND_RADIATION_CONSTANT
Second radiation constant (CODATA 2018). c_2 = hc/k_B ≈ 1.438776877e-2 m K
SILVER_RATIO
The silver ratio, which is one of the silver means. δ_s = 1 + √2 ≈ 2.4142135623730950488016887242097
SPECIAL_CHARS
A set of special characters.
SPEED_OF_LIGHT
The speed of light in vacuum (exact since 1983 SI definition). c = 299792458 m s^-1
SQRT2
The square root of 2. √2 ≈ 1.4142135623730950488016887242097
SQRT3
The square root of 3. √3 ≈ 1.7320508075688772935274463415059
SQRT5
The square root of 5. √5 ≈ 2.23606797749979
STANDARD_ATMOSPHERE
Standard atmosphere pressure (exact by definition). atm = 101325 Pa
STANDARD_GRAVITY
Standard acceleration of gravity (exact by definition). g = 9.80665 m s^-2
STEFAN_BOLTZMANN
The Stefan-Boltzmann constant (CODATA 2018, exact since 2019 SI). σ = 5.670374419 x 10^-8 W m^-2 K^-4
TAU
The circle constant, which is the ratio of a circle’s circumference to its radius. τ = 2π ≈ 6.28318530717958647692528676655900577
TAU_PARTICLE_MASS
Tau lepton mass (CODATA 2018). m_τ ≈ 3.16754e-27 kg
THOMSON_CROSS_SECTION
Thomson cross section (CODATA 2018). σ_T = (8π/3)r_e² ≈ 6.6524587321e-29 m²
TRITON_MASS
Triton mass (CODATA 2018). m_t ≈ 5.0073567446e-27 kg
VACUUM_PERMEABILITY
The vacuum permeability (CODATA 2018). μ_0 ≈ 1.25663706212 x 10^-6 N A^-2
VACUUM_PERMEABILITY_UNCERTAINTY
Standard uncertainty of VACUUM_PERMEABILITY. Source: CODATA 2018.
VACUUM_PERMITTIVITY
The vacuum permittivity (CODATA 2018). ε_0 ≈ 8.8541878128 x 10^-12 F m^-1
VACUUM_PERMITTIVITY_UNCERTAINTY
Standard uncertainty of VACUUM_PERMITTIVITY. Source: CODATA 2018.
VON_KLITZING_CONSTANT
Von Klitzing constant (CODATA 2018, exact since 2019 SI). R_K = h/e² ≈ 25812.80745 Ω
WIEN_DISPLACEMENT
Wien’s displacement constant (CODATA 2018). b ≈ 2.897771955 x 10^-3 m K
WIEN_DISPLACEMENT_UNCERTAINTY
Standard uncertainty of WIEN_DISPLACEMENT. Source: CODATA 2018.
W_BOSON_MASS_GEV
W boson mass (PDG 2022). m_W ≈ 80.377 GeV/c²
Z_BOSON_MASS_GEV
Z boson mass (PDG 2022). m_Z ≈ 91.1876 GeV/c²