logo
Expand description

The Unified Code for Units of Measure (UCUM)

This is an attempt to define a unit system for The Unified Code for Units of Measure. It does not perfectly match the specification in the ways mentioned below.


The UCUM specification uses NIST values from 1980 for experimentally determined constants. For some of these, we use the 2014 values instead, which can be found here.


There are a few classifications of units that UCUM defines but that it does not make sense to define here, and so we do not. They are as follows:

  • Units defined in terms of characters that we can’t use. For example, the symbol for minutes as measure of angle is given by a single quote, ’.

  • Units that require conversions that involve more than multiplication. These include some temperature units (such as degrees Celcius) and logrithmic units (such as decibels).


Conflicts:

While the UCUM specification aims to minimize conflicts, there are still some. Units that may conflict are indicated by the UCUM spec by square brackets. When there is a conflict, for the unit in square brackets, we name it with a trailing underscore. For example, the speed of light conflicts with coulomb, so we use C_ for the speed of light.


A note on derived units:

Mass is involved in a great many units. As the SI unit of mass is the kilogram, there are many units defined in terms of tffhe kilogram. To create a derived unit in dimensioned, it must have a value of 1.0. Since UCUM uses the gram and not the kilogram as a base unit, that leads to many common derived units being off by a factor of 1000. As a result, you will see many derived units with prefixes, such as MilliNewton and KiloFarad. The constants for the more common units (N and F for the two mentioned) are still defined, but if you need to refer to their types (such as in function signatures), this is something to bear in mind.


Following, we list all of the base units, derived units, and constants that are defined in this unit system.

Base Units

ConstantUnitPrint TokenDimension
MMetermLength
SSecondsTime
GGramgMass
RADRadianrad
KKelvinKTemperature
CCoulombCCharge
CDCandelacdLuminousIntensity

Derived Units

ConstantUnitUnit DefinitionDimension
SRSteradianRadian * Radian
HZHertzUnitless / SecondFrequency
MILLINMilliNewtonGram * Meter / Second / SecondForce
MILLIPAMilliPascalMilliNewton / Meter / MeterPressure
MILLIJMilliJouleMilliNewton * MeterEnergy
MILLIWMilliWattMilliJoule / SecondPower
AAmpereCoulomb / SecondCurrent
MILLIVMilliVoltMilliJoule / CoulombElectricPotential
KILOFKiloFaradCoulomb / MilliVoltCapacitance
MILLIOHMMilliOhmMilliVolt / AmpereResistance
KILOSIEKiloSiemensUnitless / MilliOhmConductance
MILLIWBMilliWeberMilliVolt * SecondMagneticFlux
MILLITMilliTeslaMilliWeber / Meter / Meter
MILLIHMilliHenryMilliWeber / AmpereInductance
LMLumenCandela * Steradian
LXLuxLumen / Meter / Meter
BQBecquerelUnitless / Second
GYGrayMilliJoule / Gram
SVSievertMilliJoule / Gram
S2Second2Second * Second
S3Second3Second2 * Second
M2Meter2Meter * MeterArea
M3Meter3Meter2 * MeterVolume
PMPerMeterUnitless / MeterReciprocalLength
MPSMeterPerSecondMeter / SecondVelocity
MPS2MeterPerSecond2Meter / Second2Acceleration
MPS3MeterPerSecond3Meter / Second3Jerk
M2PSMeter2PerSecondMeter2 / Second
M2PS2Meter2PerSecond2Meter2 / Second2
APMAmperePerMeterAmpere / Meter
CPM2CandelaPerMeter2Candela / Meter2
CPGCoulombPerGramCoulomb / Gram
GPMGramPerMeterGram / Meter
GPM4SGramPerMeter4SecondGram / Meter3 / Meter / Second
MILLIJSMilliJouleSecondMilliJoule * Second
MILLIJPKMilliJoulePerKelvinMilliJoule / Kelvin
KILOFPMKiloFaradPerMeterKiloFarad / Meter
MILLINPA2MilliNewtonPerAmpere2MilliNewton / Ampere / Ampere
M3PGS2Meter3PerGramSecond2Meter3 / Gram / Second2
MILLIPSMilliPascalSecondMilliPascal * Second
M3PSGMeter3PerSecondGramMeter3 / Second / Gram

Constants

NameConstantValueUnitDimension
CentimeterCMCENTI * MMeterLength
Astronomic unitASU149597.870691e6 * MMeterLength
ParsecPRS3.085678e16 * MMeterLength
Light-yearLYC_ * ANN_JMeterLength
International inchIN_I2.54 * CMMeterLength
International footFT_I12.0 * IN_IMeterLength
International yardYD_I3.0 * FT_IMeterLength
International mileMI_I5280.0 * FT_IMeterLength
International fathomFTH_I6.0 * FT_IMeterLength
International nautical mileNMI_I1852.0 * MMeterLength
International milMIL_I1.0e-3 * IN_IMeterLength
International handHD_I4.0 * IN_IMeterLength
US footFT_US1200.0 / 3937.0 * MMeterLength
US yardYD_US3.0 * FT_USMeterLength
US inchIN_USFT_US / 12.0MeterLength
US rodRD_US16.5 * FT_USMeterLength
US Gunter’s chainCH_US4.0 * RD_USMeterLength
US Gunter’s chainLK_USCH_US / 100.0MeterLength
US Ramden’s chainRCH_US100.0 * FT_USMeterLength
US Link for Ramden’s chainRLK_USRCH_US / 100.0MeterLength
US fathomFTH_US6.0 * FT_USMeterLength
US furlongFUR_US40.0 * RD_USMeterLength
US mileMI_US8.0 * FUR_USMeterLength
US milMIL_US1.0e-3 * IN_USMeterLength
British inchIN_BR2.539998 * CMMeterLength
British footFT_BR12.0 * IN_BRMeterLength
British rodRD_BR16.5 * FT_BRMeterLength
British Gunter’s chainCH_BR4.0 * RD_BRMeterLength
British link for Gunter’s chainLK_BRCH_BR / 100.0MeterLength
British fathomFTH_BR6.0 * FT_BRMeterLength
British pacePC_BR2.5 * FT_BRMeterLength
British yardYD_BR3.0 * FT_BRMeterLength
British mileMI_BR5280.0 * FT_BRMeterLength
British nautical mileNMI_BR6080.0 * FT_BRMeterLength
LineLNEIN_I / 12.0MeterLength
PointPNTLNE / 6.0MeterLength
PicaPCA12.0 * PNTMeterLength
Printer’s pointPNT_PR0.013837 * IN_IMeterLength
Printer’s picaPCA_PR12.0 * PNT_PRMeterLength
PiedPIED32.48 * CMMeterLength
PouncePOUNCEPIED / 12.0MeterLength
LigneLIGNEPOUNCE / 12.0MeterLength
DidotDIDOTLIGNE / 6.0MeterLength
CiceroCICERO12.0 * DIDOTMeterLength
CharrièreCH1.0 / 3.0 * MILLI * MMeterLength
ÅngströmAO0.1 * NANO * MMeterLength
SmootSMOOT67.0 * IN_IMeterLength
MinuteMIN60.0 * SSecondTime
HourHR60.0 * MINSecondTime
DayD24.0 * HRSecondTime
Tropical yearANN_T365.24219 * DSecondTime
Mean Julian yearANN_J365.25 * DSecondTime
Mean Gregorian yearANN_G365.2425 * DSecondTime
yearANNANN_JSecondTime
weekWK7.0 * DSecondTime
Synodal monthMO_S29.53059 * DSecondTime
Mean Julian monthMO_JANN_J / 12.0SecondTime
Mean Gregorian monthMO_GANN_G / 12.0SecondTime
MonthMOMO_JSecondTime
Svedberg unitS_1.0e-13 * SSecondTime
KilogramKGKILO * GGramMass
TonneTNE1.0e3 * KGGramMass
Unified atomic mass unitAMU1.6605402e-24 * GGramMass
Electron massM_E9.10938356e-31 * KGGramMass
Proton massM_P1.6726231e-24 * GGramMass
GrainGR64.79891 * MILLI * GGramMass
Avoirdupois poundLB_AV7000.0 * GRGramMass
Avoirdupois ounceOZ_AVLB_AV / 16.0GramMass
Avoirdupois dramDR_AVOZ_AV / 16.0GramMass
Avoirdupois short hundredweightSCWT_AV100.0 * LB_AVGramMass
Avoirdupois long hundredweightLCWT_AV112.0 * LB_AVGramMass
Avoirdupois short tonSTON_AV20.0 * SCWT_AVGramMass
Avoirdupois long tonLTON_AV20.0 * LCWT_AVGramMass
Avoirdupois stoneSTONE_AV14.0 * LB_AVGramMass
Troy pennyweightPWT_TR24.0 * GRGramMass
Troy ounceOZ_TR20.0 * PWT_TRGramMass
Troy poundLB_TR12.0 * OZ_TRGramMass
Apothecary scrupleSC_AP20.0 * GRGramMass
Apothecary dramDR_AP3.0 * SC_APGramMass
Apothecary ounceOZ_AP8.0 * DR_APGramMass
Apothecary poundLB_AP12.0 * OZ_APGramMass
Apothecary ounceOZ_M28.0 * GGramMass
Metric caratCAR_M0.2 * GGramMass
Gon, gradeGON0.9 * DEGRadian
DegreeDEG2.0 * consts::PI / 360.0 * RADRadian
CircleCIRC2.0 * consts::PI * RADRadian
Degree RankineDEGR5.0 / 9.0 * KKelvinTemperature
Elementary chargeE1.6021766208e-19 * CCoulombCharge
SphereSPH4.0 * consts::PI * SRSteradian
KatalKATMOL / SHertzFrequency
UnitUMICRO * MOL / MINHertzFrequency
NewtonNKILO * MILLINMilliNewtonForce
Gram forceGFG * G_MilliNewtonForce
Pound forceLBF_AVLB_AV * G_MilliNewtonForce
DyneDYNG * CM / S2MilliNewtonForce
PascalPAKILO * MILLIPAMilliPascalPressure
BarBAR1.0e5 * PAMilliPascalPressure
Standard atmosphereATM101325.0 * PAMilliPascalPressure
Meter of water columnMH2O9.80665 * KILO * PAMilliPascalPressure
Meter of mercury columnMHG133.3220 * KILO * PAMilliPascalPressure
Technical atmosphereATTKILO * GF / CM / CMMilliPascalPressure
Pound per square inchPSILBF_AV / IN_I / IN_IMilliPascalPressure
JouleJKILO * MILLIJMilliJouleEnergy
ElectronvoltEVE * VMilliJouleEnergy
ErgERGDYN * CMMilliJouleEnergy
Calorie at 15 °CCAL_154.18580 * JMilliJouleEnergy
Calorie at 20 °CCAL_204.18190 * JMilliJouleEnergy
Mean calorieCAL_M4.19002 * JMilliJouleEnergy
International table calorieCAL_IT4.1868 * JMilliJouleEnergy
Thermochemical calorieCAL_TH4.184 * JMilliJouleEnergy
CalorieCALCAL_THMilliJouleEnergy
Nutrition label calorieCAL_KILO * CALMilliJouleEnergy
British thermal unit at 39 °FBTU_391.05967 * KILO * JMilliJouleEnergy
British thermal unit at 59 °FBTU_591.05480 * KILO * JMilliJouleEnergy
British thermal unit at 60 °FBTU_601.05468 * KILO * JMilliJouleEnergy
Mean British thermal unitBTU_M1.05587 * KILO * JMilliJouleEnergy
International table British thermal unitBTU_IT1.05505585262 * KILO * JMilliJouleEnergy
Thermochemical British thermal unitBTU_TH1.054350 * KILO * JMilliJouleEnergy
British thermal unitBTUBTU_THMilliJouleEnergy
WattWKILO * MILLIWMilliWattPower
HorsepowerHP550.0 * FT_I * LBF_AV / SMilliWattPower
BiotBI10.0 * AAmpereCurrent
GilbertGBOE * CMAmpereCurrent
VoltVKILO * MILLIVMilliVoltElectricPotential
FaradFMILLI * KILOFKiloFaradCapacitance
OhmOHMKILO * MILLIOHMMilliOhmResistance
SiemensSIEMILLI * KILOSIEKiloSiemensConductance
MhoMHOMILLI * SIEKiloSiemensConductance
WeberWBKILO * MILLIWBMilliWeberMagneticFlux
MaxwellMX1.0e-8 * WBMilliWeberMagneticFlux
TeslaTKILO * MILLITMilliTesla
GaussGS1.0e-4 * TMilliTesla
HenryHKILO * MILLIHMilliHenryInductance
PhotPHT1.0e-4 * LXLux
CurieCI3.7e10 * BQBecquerel
AreAR100.0 * M2Meter2Area
International square inchSIN_IIN_I * IN_IMeter2Area
International square footSFT_IFT_I * FT_IMeter2Area
International square yardSYD_IYD_I * YD_IMeter2Area
International circular milCML_Iconsts::PI / 4.0 * MIL_I * MIL_IMeter2Area
US acreACR_US160.0 * RD_US * RD_USMeter2Area
US square rodSRD_USRD_US * RD_USMeter2Area
US square mileSMI_USMI_US * MI_USMeter2Area
SectionSCTMI_US * MI_USMeter2Area
TownshipTWP36.0 * SCTMeter2Area
British acreACR_BR4840.0 * YD_BR * YD_BRMeter2Area
BarnBRN100.0 * FEMTO * M * FEMTO * MMeter2Area
LiterL0.1 * 0.1 * 0.1 * M3Meter3Volume
International cubic inchCIN_IIN_I * IN_I * IN_IMeter3Volume
International cubic footCFT_IFT_I * FT_I * FT_IMeter3Volume
International cubic yardCYD_IYD_I * YD_I * YD_IMeter3Volume
International board footBF_I144.0 * CIN_IMeter3Volume
International cordCR_I128.0 * CFT_IMeter3Volume
Queen Anne’s wine gallonGAL_US231.0 * IN_I * IN_I * IN_IMeter3Volume
US barrelBBL_US42.0 * GAL_USMeter3Volume
US quartQT_USGAL_US / 4.0Meter3Volume
US pintPT_USQT_US / 2.0Meter3Volume
US gillGIL_USPT_US / 4.0Meter3Volume
US fluid OunceFOZ_USGIL_US / 4.0Meter3Volume
US fluid DramFDR_USFOZ_US / 8.0Meter3Volume
US minimMIN_USFDR_US / 60.0Meter3Volume
US cordCRD_USCR_IMeter3Volume
US bushelBU_US2150.42 * IN_I * IN_I * IN_IMeter3Volume
Historical winchester gallonGAL_WIBU_US / 8.0Meter3Volume
US peckPK_USBU_US / 4.0Meter3Volume
US dry quartDQT_USPK_US / 8.0Meter3Volume
US dry pintDPT_USDQT_US / 2.0Meter3Volume
US tablespoonTBS_USFOZ_US / 2.0Meter3Volume
US teaspoonTSP_USTBS_US / 3.0Meter3Volume
US cupCUP_US16.0 * TBS_USMeter3Volume
Metric fluid ounceFOZ_M30.0 * MILLI * LMeter3Volume
Metric cupCUP_M240.0 * MILLI * LMeter3Volume
Metric teaspoonTSP_M5.0 * MILLI * LMeter3Volume
Metric tablespoonTBS_M15.0 * MILLI * LMeter3Volume
British gallonGAL_BR4.54609 * LMeter3Volume
British peckPK_BR2.0 * GAL_BRMeter3Volume
British bushelBU_BR4.0 * PK_BRMeter3Volume
British quartQT_BRGAL_BR / 4.0Meter3Volume
British pintPT_BRQT_BR / 2.0Meter3Volume
British gillGIL_BRPT_BR / 4.0Meter3Volume
British fluid ounceFOZ_BRGIL_BR / 5.0Meter3Volume
British fluid dramFDR_BRFOZ_BR / 8.0Meter3Volume
British minimMIN_BRFDR_BR / 60.0Meter3Volume
DropDRPMILLI * L / 20.0Meter3Volume
StereSTR1.0 * M3Meter3Volume
KayserKY1.0 / CMPerMeterReciprocalLength
DiopterDIOP1.0 / MPerMeterReciprocalLength
MeshMESH_I1.0 / IN_IPerMeterReciprocalLength
Speed of light in a vacuumC_299792458.0 * MPSMeterPerSecondVelocity
International knotKN_INMI_I / HRMeterPerSecondVelocity
British knotKN_BRNMI_BR / HRMeterPerSecondVelocity
Standard acceleration of free fallG_9.80665 * M / S2MeterPerSecond2Acceleration
GalGLCM / S2MeterPerSecond2Acceleration
StokesSTCM * CM / SMeter2PerSecond
Radiation absorbed doseRAD_100.0 * ERG / GMeter2PerSecond2
Radiation equivalent manREM_RAD_Meter2PerSecond2
OerstedOE250.0 / consts::PI * A / MAmperePerMeter
StilbSBCD / CM / CMCandelaPerMeter2
LambertLMBSB / consts::PICandelaPerMeter2
RoentgenROE2.58e-4 * C / KGCoulombPerGram
TexTEX1.0 * G / (KILO * M)GramPerMeter
DenierDENTEX / 9.0GramPerMeter
Peripheral vascular resistance unitPRUMHG * S / LGramPerMeter4Second
Planck constantH_6.6260755e-34 * J * SMilliJouleSecond
Boltzmann constantK_1.380658e-23 * J / KMilliJoulePerKelvin
Permittivity of vacuumEPS_08.854187817e-12 * F / MKiloFaradPerMeter
Permeability of vacuumMU_04.0e-7 * consts::PI * N / A / AMilliNewtonPerAmpere2
Newtonian constant of gravitationGC6.67259e-11 * M3 / KG / S2Meter3PerGramSecond2
PoisePDYN * S / CM / CMMilliPascalSecond
Metabolic equivalentMET3.5 * MILLI * L / MIN / KGMeter3PerSecondGram

Re-exports

pub use self::f64consts::*;

Modules

Constants defined for this system

Constants defined for this system

Constants defined for this system

Constants defined for this system

Constants defined for this system

Constants defined for this system

Constants defined for this system

Constants defined for this system

Constants defined for this system

Constants defined for this system

Constants defined for this system

Constants defined for this system

Structs

The struct for this unit system

Type Definitions