Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/units Reorganize units.lib.



details:   https://anonhg.NetBSD.org/src/rev/0595d4c99296
branches:  trunk
changeset: 371987:0595d4c99296
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Oct 24 04:55:19 2022 +0000

description:
Reorganize units.lib.

It's all very well to file miscellaneous old units under "trivia" but
it's more useful to sort first by type and then by creakiness.

No functional change intended.

diffstat:

 usr.bin/units/units.lib |  778 +++++++++++++++++++++++++++++------------------
 1 files changed, 472 insertions(+), 306 deletions(-)

diffs (truncated from 998 to 300 lines):

diff -r 535e181d8206 -r 0595d4c99296 usr.bin/units/units.lib
--- a/usr.bin/units/units.lib   Mon Oct 24 01:54:19 2022 +0000
+++ b/usr.bin/units/units.lib   Mon Oct 24 04:55:19 2022 +0000
@@ -1,4 +1,4 @@
-/      $NetBSD: units.lib,v 1.26 2022/02/15 16:21:35 jakllsch Exp $
+/      $NetBSD: units.lib,v 1.27 2022/10/24 04:55:19 dholland Exp $
 
 / primitive units
 
@@ -58,21 +58,47 @@
 z-                     zopto
 y-                     yocto
 
+/ ////////////////////////////////////////////////////////////
 / constants
 
 fuzz                   1
+
 pi                     3.14159265358979323846
 c                      2.99792458e+8 m/sec fuzz
+e                      1.6021917e-19 coul fuzz
+k                      1.38047e-16 erg/degC
+planck                 6.626e-34 joule-sec
+hbar                   1.055e-34 joule-sec
+mole                   6.022169e+23 fuzz
+
 g                      9.80665 m/sec2
-au                     1.49597871e+11 m fuzz
-mole                   6.022169e+23 fuzz
-e                      1.6021917e-19 coul fuzz
+
+/ conversion factors used as adjectives
 energy                 c2
 force                  g
 mercury                        1.33322e+5 kg/m2-sec2
 hg                     mercury
 
-/ dimensionless
+/ standard ratios
+%                      1|100
+percent                        %
+/ proof is specific to alcohol concentration
+proof                  1|200
+
+/ ////////////////////////////////////////////////////////////
+/ counts
+
+dozen                  12
+bakersdozen            13
+score                  20
+gross                  144
+
+/ quire and ream are specific to counting sheets of paper
+quire                  25
+ream                   500
+
+/ ////////////////////////////////////////////////////////////
+/ angles
 
 radian                 .5 / pi
 degree                 1|180 pi-radian
@@ -83,17 +109,32 @@
 grade                  .9 degree
 arcdeg                 1 degree
 arcmin                 1|60 arcdeg
-ccs                    1|36 erlang
 arcsec                 1|60 arcmin
 
+centesimalminute       1e-2 grade
+centesimalsecond       1e-4 grade
+
+/ ////////////////////////////////////////////////////////////
+/ solid angles
+
 steradian              radian2
 sphere                 4 pi-steradian
 sr                     steradian
+spat                   4 pi sr
 
+/ ////////////////////////////////////////////////////////////
 / Time
 
+/ SI unit
 second                 sec
 s                      sec
+
+/ special-case abbreviations
+ms                     millisec
+ns                     nanosec
+us                     microsec
+
+/ civil timekeeping
 minute                 60 sec
 min                    minute
 hour                   60 min
@@ -101,53 +142,142 @@
 day                    24 hr
 da                     day
 week                   7 day
+fortnight              14 da
+month                  1|12 year
+mo                     month
 year                   365.24219879 day fuzz
 yr                     year
-month                  1|12 year
-ms                     millisec
-us                     microsec
+decade                 10 yr
+century                        100 year
+millennium             1000 year
+
+/ astronomical details
+siderealyear           365.256360417 day
+siderealday            23.934469444 hour
+siderealhour           1|24 siderealday
+lunarmonth             29.5305555 day
+synodicmonth           lunarmonth
+siderealmonth          27.32152777 day
+tropicalyear           year
+solaryear              year
+lunaryear              12 lunarmonth
 
-/ Mass
+/ misc
+sigma                  microsec
+
+/ ////////////////////////////////////////////////////////////
+/ Frequency
+
+hertz                  /sec
+Hz                     hertz
+hz                     /sec
+khz                    1e+3 /sec
+mhz                    1e+6 /sec
+rpm                    rev/minute
+rps                    rev/sec
+
+fresnel                        1e12 hertz
+pulsatance             2 pi/sec
+
+/ ////////////////////////////////////////////////////////////
+/ Mass and weight
 
 gram                   millikg
+gramme                 gram
 gm                     gram
 mg                     milligram
 metricton              kilokg
+tonne                  1e+6 gm
 
-/ Avoirdupois
+atomicmassunit         1.66044e-27 kg fuzz
+amu                    atomicmassunit
+dalton                 amu
+
+electronmass           9.1095e-31 kg
+protonmass             1.6726e-27 kg
+neutronmass            1.6606e-27 kg
+
+carat                  205 mg
+metriccarat            200 mg
+quintal                        100 kg
+
+/ Avoirdupois weight
 
 lb                     .45359237 kg
 pound                  lb
-lbf                    lb g
 ounce                  1|16 lb
 oz                     ounce
 dram                   1|16 oz
 dr                     dram
 grain                  1|7000 lb
 gr                     grain
+stone                  14 lb
 shortton               2000 lb
 ton                    shortton
 longton                        2240 lb
 
-/ Apothecary
+bag                    94 lb
+cental                 100 lb
+longhundredweight      112 lb
+longquarter            28 lb
+pennyweight            1|20 oz
+pwt                    pennyweight
+shorthundredweight     100 lb
+shortquarter           25 lb
+weymass                        252 lb
+
+/ Related mass units
+/
+/ According to Wikipedia there are two definitions for hyl, one using
+/ grams and one using kilograms. beware
+
+hyl                    gm force sec2/m
+slug                   lb-g-sec2/ft
+
+/ Apothecary weight
 
 scruple                        20 grain
 apdram                 60 grain
+drachm                 60 grain
 apounce                        480 grain
 appound                        5760 grain
 troypound              appound
 troyounce              1|12 troypound
 
+/ Thai weight
+
+salueng                        3.75 gm
+baht                   4 salueng
+tamlueng               4 baht
+chang                  20 tamlueng
+hap                    50 chang
+
+/ ////////////////////////////////////////////////////////////
 / Length
 
+/ SI unit
 meter                  m
+metre                  meter
+
+/ special-case abbreviations
 cm                     centimeter
 mm                     millimeter
 km                     kilometer
 nm                     nanometer
-micron                 micrometer
+
+/ other metric units
 angstrom               decinanometer
+fermi                  1e-15 m
+micron                 micrometer
 
+/ space-sized lengths
+au                     1.49597871e+11 m fuzz
+astronomicalunit       au
+lightyear              c-yr
+parsec                 au-radian/arcsec
+pc                     parsec
+
+/ English system lengths
 inch                   2.54 cm
 in                     inch
 foot                   12 in
@@ -155,43 +285,200 @@
 ft                     foot
 yard                   3 ft
 yd                     yard
-rod                    5.5 yd
-rd                     rod
 mile                   5280 ft
 mi                     mile
+league                 3 mi
+mil                    1e-3 in
 
 british                        1200|3937 m/ft
+
+/ nautical
+/ Historically, the nautical mile was 6080 feet (6080.2 in England)
+/ but was changed to 1852 meters (6076 feet and change) in the 20th
+/ century with varying dates of adoption around the world.
+/ https://en.wikipedia.org/wiki/Nautical_mile
+fathom                 6 ft
 nmile                  1852 m
+nauticalmile           nmile
+marineleague           3 nmile
+cable                  720 ft
+
+/ surveying
+rod                    5.5 yd
+rd                     rod
+perch                  rd
+pole                   rd
+chain                  66 ft
+link                   66|100 ft
+furlong                        220 yd
+surveyfoot             british-ft
+surveyyard             3 surveyfoot
+surveyorschain         66 ft
+surveyorslink          66|100 ft
+
+/ typographical
+pica                   1|6 in
+point                  1|72 in
+
+/ data centers and machine rooms
+rackunit               1.75 in
+RU                     rackunit
+U                      rackunit
+
+/ physics
+bohrradius             hbar2-C2/8.988e9 N m2-e2-electronmass
+
+/ miscellaneous/historical/obscure English units
+line                   1|12 in
+barleycorn             1|3 in
+finger                 7|8 in
+nail                   1|16 yd



Home | Main Index | Thread Index | Old Index