From 92e69afba72f7ff46480e021cc44f983cf4ea286 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 18 May 2022 15:14:41 +0200 Subject: [PATCH] Define inches, m2, and ft3 to simplify the patch --- definitions.units.patch | 93 ++++++++++----------------------------- definitions.units.patched | 20 +++++---- expected/units.out | 21 +++++---- unit_units.data | 19 ++++---- 4 files changed, 58 insertions(+), 95 deletions(-) diff --git a/definitions.units.patch b/definitions.units.patch index 2e2bfe5..1faf45a 100644 --- a/definitions.units.patch +++ b/definitions.units.patch @@ -1,5 +1,5 @@ --- definitions.units 2022-05-17 15:32:26.767162879 +0200 -+++ definitions.units.patched 2022-05-17 17:01:46.803764124 +0200 ++++ definitions.units.patched 2022-05-18 15:10:02.482372402 +0200 @@ -227,7 +227,7 @@ # equator to a pole. @@ -63,7 +63,7 @@ n- nano p- pico f- femto -@@ -676,6 +683,13 @@ +@@ -676,6 +683,14 @@ padm 1e15 shankh 1e17 @@ -72,12 +72,13 @@ +π pi +astronomicalunit 149597870700 m # IAU definition from 2012, exact +au astronomicalunit # ephemeris for the above described ++m2 m^2 + + ############################################################################# # # # Derived units which can be reduced to the primitive units # -@@ -945,7 +959,7 @@ +@@ -945,7 +960,7 @@ pointangle 1|32 circle # Used for reporting compass readings centrad 0.01 radian # Used for angular deviation of light # through a prism. @@ -86,7 +87,7 @@ seclongitude circle (seconds/day) # Astronomers measure longitude # (which they call right ascension) in # time units by dividing the equator into -@@ -1066,8 +1080,8 @@ +@@ -1066,8 +1081,8 @@ tempF(x) units=[1;K] domain=[-459.67,) range=[0,) \ (x+(-32)) degF + stdtemp ; (tempF+(-stdtemp))/degF + 32 tempfahrenheit() tempF @@ -97,7 +98,7 @@ degreesrankine degF # The Rankine scale has the -@@ -1079,7 +1093,7 @@ +@@ -1079,7 +1094,7 @@ tempreaumur(x) units=[1;K] domain=[-218.52,) range=[0,) \ x degreaumur+stdtemp ; (tempreaumur+(-stdtemp))/degreaumur @@ -106,7 +107,7 @@ # particularly in France. It is defined # to be 0 at the freezing point of water # and 80 at the boiling point. Reaumur -@@ -1167,7 +1181,7 @@ +@@ -1167,7 +1182,7 @@ # Basic constants @@ -115,21 +116,23 @@ light c mu0_SI 2 alpha h_SI / e_SI^2 c_SI # Vacuum magnetic permeability mu0 2 alpha h / e^2 c # Gets overridden in CGS modes -@@ -1310,6 +1324,13 @@ +@@ -1310,6 +1325,15 @@ H2O50C 0.98807 force gram / cm^3 H2O100C 0.95838 force gram / cm^3 +# moved because ft is used before being defined (and otherwise parsed as femtotonne) +inch 2.54 cm +in inch ++inches inch +foot 12 inch +feet foot +ft foot ++ft3 ft^3 + # Atomic constants -@@ -1664,7 +1685,7 @@ +@@ -1664,7 +1688,7 @@ abampere 10 A # Current which produces a force of abamp abampere # 2 dyne/cm between two infinitely @@ -138,29 +141,7 @@ abA abampere biot abampere Bi biot -@@ -2092,8 +2113,8 @@ - - # Reflected-light meter calibration constant with ISO 100 speed - --k1250 12.5 (cd/m2) / lx s # For Canon, Nikon, and Sekonic --k1400 14 (cd/m2) / lx s # For Kenko (Minolta) and Pentax -+k1250 12.5 (cd/m^2) / lx s # For Canon, Nikon, and Sekonic -+k1400 14 (cd/m^2) / lx s # For Kenko (Minolta) and Pentax - - # Incident-light meter calibration constant with ISO 100 film - -@@ -2147,8 +2168,8 @@ - # ASA PH2.12-1961, and ANSI PH2.7-1986 - #N_apex 0.3162 lx s # value in ANSI PH2.7-1973 - N_exif 1|3.125 lx s # value in Exif 2.3 (2010), making Sv(5) = 100 --K_apex1961 11.4 (cd/m2) / lx s # value in ASA PH2.12-1961 --K_apex1971 12.5 (cd/m2) / lx s # value in ANSI PH3.49-1971; more common -+K_apex1961 11.4 (cd/m^2) / lx s # value in ASA PH2.12-1961 -+K_apex1971 12.5 (cd/m^2) / lx s # value in ANSI PH3.49-1971; more common - C_apex1961 224 lx / lx s # value in PH2.12-1961 (20.83 for I in - # footcandles; flat sensor?) - C_apex1971 322 lx / lx s # mean value in PH3.49-1971 (30 +/- 5 for I in -@@ -2482,8 +2503,8 @@ +@@ -2482,8 +2506,8 @@ # gravitational constant. This is a # fictional year, and doesn't # correspond to any celestial event. @@ -171,7 +152,7 @@ # astronomical unit. (See the NASA # site listed above.) GMsun 1.32712440018e20 m^3 / s^2 # heliocentric gravitational constant -@@ -2851,11 +2872,6 @@ +@@ -2851,11 +2875,6 @@ int 3937|1200 ft/m # Convert US Survey measures to int- int # international measures @@ -183,7 +164,7 @@ yard 3 ft yd yard mile 5280 ft # The mile was enlarged from 5000 ft -@@ -3003,6 +3019,7 @@ +@@ -3003,6 +3022,7 @@ # Liquid measure usgallon 231 in^3 # US liquid measure is derived from @@ -191,7 +172,7 @@ gal gallon # the British wine gallon of 1707. quart 1|4 gallon # See the "winegallon" entry below pint 1|2 quart # more historical information. -@@ -3504,7 +3521,7 @@ +@@ -3504,7 +3524,7 @@ number1can 10 usfloz number2can 19 usfloz @@ -200,7 +181,7 @@ number3can 4 uscups number5can 7 uscups number10can 105 usfloz -@@ -4469,10 +4486,10 @@ +@@ -4469,10 +4489,10 @@ btu btu_IT # International Table BTU is the default britishthermalunit btu @@ -215,18 +196,7 @@ btu_ISO 1055.06 J # Exact, rounded ISO definition based # on the IT calorie quad quadrillion btu -@@ -4599,8 +4616,8 @@ - # of coal used in the 1950's - barreloil 5.8 Mbtu # Conventional value for barrel of crude - # oil [E2]. Actual range is 5.6 - 6.3. --naturalgas_HHV 1027 btu/ft3 # Energy content of natural gas. HHV --naturalgas_LHV 930 btu/ft3 # is for Higher Heating Value and -+naturalgas_HHV 1027 btu/ft^3 # Energy content of natural gas. HHV -+naturalgas_LHV 930 btu/ft^3 # is for Higher Heating Value and - naturalgas naturalgas_HHV # includes energy from condensation - # combustion products. LHV is for Lower - # Heating Value and excludes these. -@@ -4635,7 +4652,7 @@ +@@ -4635,7 +4655,7 @@ # Celsius heat unit: energy to raise a pound of water 1 degC @@ -235,7 +205,7 @@ chu celsiusheatunit POWER watt -@@ -4695,13 +4712,13 @@ +@@ -4695,13 +4715,13 @@ Uvalue 1/Rvalue europeanUvalue watt / m^2 K RSI degC m^2 / W @@ -251,16 +221,7 @@ # Thermal Conductivity of a few materials -@@ -5094,7 +5111,7 @@ - europeanpoint didotpoint # for the point used in Europe - cicero 12 didotpoint - --stick 2 inches -+stick 2 in - - # Type sizes - -@@ -5167,8 +5184,8 @@ +@@ -5167,8 +5187,8 @@ # to symbols per second. Modern # modems transmit several bits # per symbol. @@ -271,16 +232,7 @@ # them do. But beware: for # transmission over modems, a # few extra bits are used so -@@ -5527,7 +5544,7 @@ - boardfeet boardfoot - fbm boardfoot # feet board measure - stack 4 yard^3 # British, used for firewood and coal [18] --rick 4 ft 8 ft 16 inches # Stack of firewood, supposedly -+rick 4 ft 8 ft 16 in # Stack of firewood, supposedly - # sometimes called a face cord, but this - # value is equal to 1|3 cord. Name - # comes from an old Norse word for a -@@ -6607,7 +6624,7 @@ +@@ -6607,7 +6627,7 @@ pa Pa ev eV @@ -289,7 +241,7 @@ oe Oe mh mH rd rod -@@ -6989,7 +7006,8 @@ +@@ -6989,7 +7009,8 @@ Mag Maz gravity # force Maz Volm kg / oldliter # mass based on water @@ -299,11 +251,12 @@ Gf Grafut Sf Surf Vm Volm -@@ -7779,7 +7797,6 @@ +@@ -7779,7 +7800,7 @@ ton uston scruple apscruple fluidounce usfluidounce -gallon usgallon ++#gallon usgallon bushel usbushel quarter quarterweight cup uscup diff --git a/definitions.units.patched b/definitions.units.patched index b36ce6a..e8f1af1 100644 --- a/definitions.units.patched +++ b/definitions.units.patched @@ -688,6 +688,7 @@ pi 3.14159265358979323846 π pi astronomicalunit 149597870700 m # IAU definition from 2012, exact au astronomicalunit # ephemeris for the above described +m2 m^2 ############################################################################# @@ -1327,9 +1328,11 @@ H2O100C 0.95838 force gram / cm^3 # moved because ft is used before being defined (and otherwise parsed as femtotonne) inch 2.54 cm in inch +inches inch foot 12 inch feet foot ft foot +ft3 ft^3 # Atomic constants @@ -2113,8 +2116,8 @@ iso100 s100 # Reflected-light meter calibration constant with ISO 100 speed -k1250 12.5 (cd/m^2) / lx s # For Canon, Nikon, and Sekonic -k1400 14 (cd/m^2) / lx s # For Kenko (Minolta) and Pentax +k1250 12.5 (cd/m2) / lx s # For Canon, Nikon, and Sekonic +k1400 14 (cd/m2) / lx s # For Kenko (Minolta) and Pentax # Incident-light meter calibration constant with ISO 100 film @@ -2168,8 +2171,8 @@ iv100(x) units=[1;lx] range=(0,) 2^x c250 / s100; log2(iv100 s100 / c250) # ASA PH2.12-1961, and ANSI PH2.7-1986 #N_apex 0.3162 lx s # value in ANSI PH2.7-1973 N_exif 1|3.125 lx s # value in Exif 2.3 (2010), making Sv(5) = 100 -K_apex1961 11.4 (cd/m^2) / lx s # value in ASA PH2.12-1961 -K_apex1971 12.5 (cd/m^2) / lx s # value in ANSI PH3.49-1971; more common +K_apex1961 11.4 (cd/m2) / lx s # value in ASA PH2.12-1961 +K_apex1971 12.5 (cd/m2) / lx s # value in ANSI PH3.49-1971; more common C_apex1961 224 lx / lx s # value in PH2.12-1961 (20.83 for I in # footcandles; flat sensor?) C_apex1971 322 lx / lx s # mean value in PH3.49-1971 (30 +/- 5 for I in @@ -4616,8 +4619,8 @@ toncoal 7e9 cal_IT # Energy in metric ton coal from [18]. # of coal used in the 1950's barreloil 5.8 Mbtu # Conventional value for barrel of crude # oil [E2]. Actual range is 5.6 - 6.3. -naturalgas_HHV 1027 btu/ft^3 # Energy content of natural gas. HHV -naturalgas_LHV 930 btu/ft^3 # is for Higher Heating Value and +naturalgas_HHV 1027 btu/ft3 # Energy content of natural gas. HHV +naturalgas_LHV 930 btu/ft3 # is for Higher Heating Value and naturalgas naturalgas_HHV # includes energy from condensation # combustion products. LHV is for Lower # Heating Value and excludes these. @@ -5111,7 +5114,7 @@ didotpoint germandidotpoint # This seems to be the dominant value europeanpoint didotpoint # for the point used in Europe cicero 12 didotpoint -stick 2 in +stick 2 inches # Type sizes @@ -5544,7 +5547,7 @@ boardfoot ft^2 inch # Usually 1 inch thick wood boardfeet boardfoot fbm boardfoot # feet board measure stack 4 yard^3 # British, used for firewood and coal [18] -rick 4 ft 8 ft 16 in # Stack of firewood, supposedly +rick 4 ft 8 ft 16 inches # Stack of firewood, supposedly # sometimes called a face cord, but this # value is equal to 1|3 cord. Name # comes from an old Norse word for a @@ -7797,6 +7800,7 @@ hundredweight ushundredweight ton uston scruple apscruple fluidounce usfluidounce +#gallon usgallon bushel usbushel quarter quarterweight cup uscup diff --git a/expected/units.out b/expected/units.out index 822e27a..052640a 100644 --- a/expected/units.out +++ b/expected/units.out @@ -771,11 +771,11 @@ SELECT name, unit, definition FROM unit_units ORDER BY dimension(unit), unit, na ㎐ | 1 Hz | Hz ㏃ | 1 Hz | Bq rps | 6.28318530717959 Hz | rev/sec - K_apex1961 | 11.4 Hz | 11.4 (cd/m^2) / lx s - K_apex1971 | 12.5 Hz | 12.5 (cd/m^2) / lx s + K_apex1961 | 11.4 Hz | 11.4 (cd/m2) / lx s + K_apex1971 | 12.5 Hz | 12.5 (cd/m2) / lx s K_lum | 12.5 Hz | K_apex1971 - k1250 | 12.5 Hz | 12.5 (cd/m^2) / lx s - k1400 | 14 Hz | 14 (cd/m^2) / lx s + k1250 | 12.5 Hz | 12.5 (cd/m2) / lx s + k1400 | 14 Hz | 14 (cd/m2) / lx s C_apex1961 | 224 Hz | 224 lx / lx s C_illum | 224 Hz | C_apex1961 c250 | 250 Hz | 250 lx / lx s @@ -1305,6 +1305,7 @@ SELECT name, unit, definition FROM unit_units ORDER BY dimension(unit), unit, na irishinch | 25.3999558333333 mm | UKinch in | 25.4 mm | inch inch | 25.4 mm | 2.54 cm + inches | 25.4 mm | inch ㏌ | 25.4 mm | in scotsinch | 25.5371293108095 mm | 1.00540054 UKinch frenchinch | 27.0699487475637 mm | 1|12 frenchfoot @@ -1331,7 +1332,7 @@ SELECT name, unit, definition FROM unit_units ORDER BY dimension(unit), unit, na sizeIring | 47.5 mm | 47.50 mm sizeJring | 48.75 mm | 48.75 mm sizeKring | 50 mm | 50.00 mm - stick | 50.8 mm | 2 in + stick | 50.8 mm | 2 inches sizeLring | 51.25 mm | 51.25 mm sizeMring | 52.5 mm | 52.50 mm sizeNring | 53.75 mm | 53.75 mm @@ -1778,6 +1779,7 @@ SELECT name, unit, definition FROM unit_units ORDER BY dimension(unit), unit, na Epaper | 0.96515936 m^2 | 34 inch 44 inch A0paper | 0.999949 m^2 | 841 mm 1189 mm AREA | 1 m^2 | LENGTH^2 + m2 | 1 m^2 | m^2 ㎡ | 1 m^2 | m^2 C0paper | 1.189349 m^2 | 917 mm 1297 mm B0paper | 1.414 m^2 | 1000 mm 1414 mm @@ -2639,6 +2641,7 @@ SELECT name, unit, definition FROM unit_units ORDER BY dimension(unit), unit, na amphora | 0.0278448991488 m^3 | 8 congii amphorae | 0.0278448991488 m^3 | amphora quadrantal | 0.0278448991488 m^3 | amphora + ft3 | 0.028316846592 m^3 | ft^3 timberfoot | 0.028316846592 m^3 | ft^3 irishbushel | 0.0285264522014338 m^3 | 4 irishpeck ponykeg | 0.029336941326 m^3 | 1|2 beerkeg @@ -2740,7 +2743,7 @@ SELECT name, unit, definition FROM unit_units ORDER BY dimension(unit), unit, na shippington | 1.13267386368 m^3 | 40 ft^3 brshippington | 1.189307556864 m^3 | 42 ft^3 housecord | 1.208185454592 m^3 | 1|3 cord - rick | 1.208185454592 m^3 | 4 ft 8 ft 16 in + rick | 1.208185454592 m^3 | 4 ft 8 ft 16 inches brchaldron | 1.30927392 m^3 | 36 brbushel imperialchaldron | 1.30927392 m^3 | brchaldron last | 1.4547488 m^3 | 40 brbushel @@ -3244,9 +3247,9 @@ SELECT name, unit, definition FROM unit_units ORDER BY dimension(unit), unit, na ㎫ | 1 MPa | MPa ksi | 6.89475729316836 MPa | kip / in^2 tsi | 13.7895145863367 MPa | ton force / inch^2 - naturalgas_LHV | 34.6508196012831 MPa | 930 btu/ft^3 + naturalgas_LHV | 34.6508196012831 MPa | 930 btu/ft3 naturalgas | 38.2649373446427 MPa | naturalgas_HHV - naturalgas_HHV | 38.2649373446427 MPa | 1027 btu/ft^3 + naturalgas_HHV | 38.2649373446427 MPa | 1027 btu/ft3 propane | 93.3 MPa | 93.3 MJ/m^3 butane | 124 MPa | 124 MJ/m^3 ㎬ | 1 GPa | GPa @@ -3316,7 +3319,7 @@ SELECT name, unit, definition FROM unit_units ORDER BY dimension(unit), unit, na reyn | 6.89475729316836 Mg/m*s | psi sec lorentz | 46.6864477828202 s^2*A/m*kg | bohrmagneton / h c THERMAL_RESISTIVITY | 1 s^3*K/m*kg | 1/THERMAL_CONDUCTIVITY -(3192 rows) +(3195 rows) -- units that do not conform to their original definition SELECT name, unit, definition, definition::unit AS parsed_definition, unit / definition::unit AS deviation diff --git a/unit_units.data b/unit_units.data index e585ae5..381ec98 100644 --- a/unit_units.data +++ b/unit_units.data @@ -161,6 +161,7 @@ pi 3.14159265358979312 \N 3.14159265358979323846 \N π 3.14159265358979312 \N pi \N astronomicalunit 149597870700 m \N 149597870700 m \N au 149597870700 m \N astronomicalunit \N +m2 1 m^2 \N m^2 \N newton 1 m*kg/s^2 \N kg m / s^2 \N N 1 m*kg/s^2 \N newton \N pascal 1 kg/m*s^2 \N N/m^2 \N @@ -420,9 +421,11 @@ H2O50C 9689.65666549999878 kg/m^2*s^2 \N 0.98807 force gram / cm^3 \N H2O100C 9398.49722699999984 kg/m^2*s^2 \N 0.95838 force gram / cm^3 \N inch 0.0254000000000000024 m \N 2.54 cm \N in 0.0254000000000000024 m \N inch \N +inches 0.0254000000000000024 m \N inch \N foot 0.304800000000000015 m \N 12 inch \N feet 0.304800000000000015 m \N foot \N ft 0.304800000000000015 m \N foot \N +ft3 0.0283168465920000043 m^3 \N ft^3 \N R_H 10967760 m^-1 \N 10967760 /m \N alpha 0.00729735256930000038 \N 7.2973525693e-3 \N conductancequantum 7.74809172986364871e-05 s^3*A^2/m^2*kg \N 2 e^2 / h \N @@ -656,12 +659,12 @@ skylum_o 2000 cd/m^2 \N 2000 cd/m^2 \N moonlum 2500 cd/m^2 \N 2500 cd/m^2 \N s100 100 m^2/s*cd \N 100 / lx s \N iso100 100 m^2/s*cd \N s100 \N -k1250 12.5 s^-1 \N 12.5 (cd/m^2) / lx s \N -k1400 14 s^-1 \N 14 (cd/m^2) / lx s \N +k1250 12.5 s^-1 \N 12.5 (cd/m2) / lx s \N +k1400 14 s^-1 \N 14 (cd/m2) / lx s \N c250 250 s^-1 \N 250 lx / lx s \N N_exif 0.320000000000000007 s*cd/m^2 \N 1|3.125 lx s \N -K_apex1961 11.4000000000000004 s^-1 \N 11.4 (cd/m^2) / lx s \N -K_apex1971 12.5 s^-1 \N 12.5 (cd/m^2) / lx s \N +K_apex1961 11.4000000000000004 s^-1 \N 11.4 (cd/m2) / lx s \N +K_apex1971 12.5 s^-1 \N 12.5 (cd/m2) / lx s \N C_apex1961 224 s^-1 \N 224 lx / lx s \N C_apex1971 322 s^-1 \N 322 lx / lx s \N N_speed 0.320000000000000007 s*cd/m^2 \N N_exif \N @@ -1814,7 +1817,7 @@ Q 0.000250000000000000005 m \N 1|4 mm \N didotpoint 0.000376064999999999971 m \N germandidotpoint \N europeanpoint 0.000376064999999999971 m \N didotpoint \N cicero 0.00451277999999999922 m \N 12 didotpoint \N -stick 0.0508000000000000049 m \N 2 in \N +stick 0.0508000000000000049 m \N 2 inches \N excelsior 0.00105437941054379409 m \N 3 oldpoint \N brilliant 0.00123010931230109325 m \N 3.5 oldpoint \N diamondtype 0.0014058392140583922 m \N 4 oldpoint \N @@ -1935,7 +1938,7 @@ boardfoot 0.00235973721600000021 m^3 \N ft^2 inch \N boardfeet 0.00235973721600000021 m^3 \N boardfoot \N fbm 0.00235973721600000021 m^3 \N boardfoot \N stack 3.05821943193600099 m^3 \N 4 yard^3 \N -rick 1.20818545459200033 m^3 \N 4 ft 8 ft 16 in \N +rick 1.20818545459200033 m^3 \N 4 ft 8 ft 16 inches \N stere 1 m^3 \N m^3 \N timberfoot 0.0283168465920000043 m^3 \N ft^3 \N standard 4.67227968768000146 m^3 \N 120 12 ft 11 in 1.5 in \N @@ -3014,8 +3017,8 @@ quad 1.05505585262000026e+18 m^2*kg/s^2 \N quadrillion btu \N specificheat_water 4184 m^2/s^2*K \N calorie / g K \N water_specificheat 4184 m^2/s^2*K \N specificheat_water \N barreloil 6119323945.19600105 m^2*kg/s^2 \N 5.8 Mbtu \N -naturalgas_HHV 38264937.344642736 kg/m*s^2 \N 1027 btu/ft^3 \N -naturalgas_LHV 34650819.6012830958 kg/m*s^2 \N 930 btu/ft^3 \N +naturalgas_HHV 38264937.344642736 kg/m*s^2 \N 1027 btu/ft3 \N +naturalgas_LHV 34650819.6012830958 kg/m*s^2 \N 930 btu/ft3 \N naturalgas 38264937.344642736 kg/m*s^2 \N naturalgas_HHV \N coal_US 24250848.8403365314 m^2/s^2 \N 22 GJ / uston \N ethanol_HHV 23412166674.8845291 kg/m*s^2 \N 84000 btu/usgallon \N