/       $NetBSD: units.lib,v 1.30 2022/11/20 14:53:14 jakllsch Exp $

/ primitive units

m                       !a!
kg                      !b!
sec                     !c!
coul                    !d!
candela                 !e!
dollar                  !f!
bit                     !h!
erlang                  !i!
K                       !j!

/ prefixes

quetta-                 1e30
ronna-                  1e27
yotta-                  1e24
zetta-                  1e21
exa-                    1e18
peta-                   1e15
tera-                   1e12
giga-                   1e9
mega-                   1e6
myria-                  1e4
kilo-                   1e3
hecto-                  1e2
deka-                   1e1
deci-                   1e-1
centi-                  1e-2
milli-                  1e-3
micro-                  1e-6
nano-                   1e-9
pico-                   1e-12
femto-                  1e-15
atto-                   1e-18
zopto-                  1e-21
yocto-                  1e-24
ronto-                  1e-27
quecto-                 1e-30

semi-                   .5
demi-                   .5

Q-                      quetta
R-                      ronna
Y-                      yotta
Z-                      zetta
E-                      exa
P-                      peta
T-                      tera
G-                      giga
M-                      mega
k-                      kilo
h-                      hecto
da-                     deka
d-                      deci
c-                      centi
m-                      milli
p-                      pico
f-                      femto
a-                      atto
z-                      zopto
y-                      yocto
r-                      ronto
q-                      quecto

/ ////////////////////////////////////////////////////////////
/ 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

/ conversion factors used as adjectives
energy                  c2
force                   g
mercury                 1.33322e+5 kg/m2-sec2
hg                      mercury

/ 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
circle                  2 pi-radian
turn                    2 pi-radian
revolution              turn
rev                     turn
grade                   .9 degree
arcdeg                  1 degree
arcmin                  1|60 arcdeg
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
hr                      hour
day                     24 hr
da                      day
week                    7 day
fortnight               14 da
month                   1|12 year
mo                      month
year                    365.24219879 day fuzz
yr                      year
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

/ 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

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
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

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

/ 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
feet                    foot
ft                      foot
yard                    3 ft
yd                      yard
mile                    5280 ft
mi                      mile
league                  3 mi
mil                     1e-3 in

/ 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
/
/ The US cable is 720 feet. The international cable is 1/10 nautical
/ mile, which is substantially shorter. The UK Admiralty cable is
/ apparently 1/10 of a historical Admiralty nautical mile, which is
/ 1853.2 instead of 1852 meters. These definitions date from the 20th
/ century. Historically, a cable was 100 fathoms, but the fathom
/ hadn't yet been fixed at 6 feet, so cables weren't a fixed length
/ either.
/ https://en.wikipedia.org/wiki/Cable_(unit)
/
fathom                  6 ft
nmile                   1852 m
nauticalmile            nmile
marineleague            3 nmile
cable                   1|10 nmile
uscable                 720 ft
admiraltycable          185.32 m

/ surveying
/
/ The US survey foot is defined as 1200/3937 meters, as opposed to the
/ ordinary international foot, which is 0.3048 meter (that's exactly
/ 2.54 cm to the inch as defined above.) These differ slightly.
/ https://en.wikipedia.org/wiki/Foot_(unit)
/
/ In the US, rods, chains, and furlongs are defined in terms of survey
/ feet, though the Wikipedia page on furlongs claims without citation
/ that some states use one definition and some the other. However, it
/ appears that as of 2022 this definition is on the way out, and other
/ jurisdictions define these units (to the extent they're used at all)
/ in terms of the international foot.
/ https://en.wikipedia.org/wiki/Rod_(unit)
/ https://en.wikipedia.org/wiki/Furlong_(unit)
/
/ Consequently we'll make two sets of definitions and prefix the
/ variant US ones with "us".
/
/ Since historically this file defined "surveyfoot" and "surveyyard"
/ but "surveyorschain" and "surveyorslink", we will now end up with
/ several sets for consistency.
/
surveyfoot              1200|3937 meter
surveyyard              3 surveyfoot

rod                     5.5 yard
rd                      rod
perch                   rod
pole                    rod
chain                   66 foot
link                    1|100 chain
furlong                 220 yard

usrod                   5.5 surveyyard
usperch                 usrod
uspole                  usrod
uschain                 66 surveyfoot
uslink                  1|100 uschain
usfurlong               220 surveyyard

surveyorsfoot           surveyfoot
surveyorsyard           surveyyard
surveyorsrod            usrod
surveyorschain          uschain
surveyorslink           uslink

/ These are the same as the basic ones based on the international foot.
/ https://en.wikipedia.org/wiki/Gunter's_chain
/ https://en.wikipedia.org/wiki/Imperial_units
guntersrod              rod
gunterschain            chain
gunterslink             link

/ 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
palm                    3 in
hand                    4 in
quarter                 9 in
span                    9 in
cubit                   18 in
militarypace            2.5 feet
pace                    36 in
ell                     45 in
smoot                   67 in
rope                    20 ft
bolt                    40 yd
skein                   120 yd
spindle                 14400 yd

/ more ells
flemishell              27 inch
scottishell             37.2 inch
englishell              45 inch

/ I can't find supporting evidence for this definition.
rood                    1.21e+3 yd

/ other
geodeticfoot            surveyfoot
geographicalmile        1852 m
engineerschain          100 ft
engineerslink           100|100 ft

/ note that while caliber is technically a unit, caliber sizes for ammunition
/ are usually short names for more complicated specifications.
caliber                 1e-2 in

frenchfoot              16|15 ft
frenchfeet              frenchfoot
toise                   6 frenchfeet

parasang                3.5 mi

/ Thai length

krabiat                 0.5208 cm
nio                     4 krabiat
khuep                   12 nio
sok                     2 khuep
wah                     4 sok
sen                     20 wah
yot                     400 sen

/ ////////////////////////////////////////////////////////////
/ Speed

admiraltyknot           6080 ft/hr
knot                    nmile/hr
mph                     mile/hr

/ The speed of sound varies substantially with density, and thus
/ both pressure and temperature. This number appears to be for
/ 0 degrees Celsius at sea level. The value is considerably lower
/ at typical flight altitudes for high-performance aircraft.
mach                    331.46 m/sec

/ ////////////////////////////////////////////////////////////
/ Area

/ metric
are                     1e+2 m2
hectare                 1e+4 m2

/ English
sabin                   1 ft2
square                  100 ft2
acre                    4840 yd2
homestead               1|4 mi2
quartersection          1|4 mi2
section                 mi2
township                36 mi2

/ particle physics
barn                    1e-28 m2
shed                    1e-24 barn

/ Thai area
tarangwah               wah2
ngan                    100 tarangwah
rai                     4 ngan

/ ////////////////////////////////////////////////////////////
/ Volume

/ metric
cc                      cm3
liter                   kilocc
litre                   liter
ml                      milliliter
stere                   m3

/ US liquid volume

gallon                  231 in3
gal                     gallon
quart                   1|4 gal
qt                      quart
pint                    1|2 qt
pt                      pint
cup                     1|2 pt
gill                    1|4 pt
floz                    1|16 pt
tablespoon              1|2 floz
teaspoon                1|3 tablespoon
fldr                    1|8 floz
minim                   1|60 fldr

barrel                  42 gal
hogshead                63 gallon
hd                      hogshead

noggin                  1|8 qt
fifth                   4|5 qt
firkin                  9 gal
kilderkin               18 gal
pipe                    4 barrel
tun                     8 barrel

/ US dry volume

dry                     268.8025 in3/gallon fuzz

peck                    8 dry-quart
pk                      peck
bushel                  4 peck
bu                      bushel
strike                  2 bu
sack                    3 bu
coomb                   4 bu
seam                    8 bu
chaldron                36 bushel
wey                     40 bu
last                    80 bu

cord                    128 ft3
cordfoot                cord

/ British volume

imperial                1.20095

brgallon                277.420 in3 fuzz
brquart                 1|4 brgallon
brpint                  1|2 brquart
brfloz                  1|20 brpint
brpeck                  554.84 in3 fuzz
brbushel                4 brpeck
cran                    37.5 brgallon

/ Bottles

bottle                  750 milliliter
/bottle                 fifth

miniature               100 milliliter
split                   1|4 bottle
half                    1|2 bottle
magnum                  2 bottle
jeroboam                4 bottle
rehoboam                6 bottle
methuselah              8 bottle
salmanazar              12 bottle
balthazar               16 bottle
nebuchadnezzar          20 bottle
sovereign               34 bottle

/ Bottles - alternate names and spellings

pony                    split
fillette                half
tappithen               3 bottle
rheoboam                rehoboam
shalmaneser             salmanazar

/ ////////////////////////////////////////////////////////////
/ Force

/ SI unit
newton                  kg-m/sec2
nt                      newton
N                       newton

/ metric units
dyne                    cm-gm/sec2
sthene                  1e+3 nt

/ foot/pound units
lbf                     lb g
kip                     1000 lbf
poundal                 ft-lb/sec2
pdl                     poundal

/ ////////////////////////////////////////////////////////////
/ Pressure

/ SI unit
pascal                  nt/m2

/ metric units
bar                     1e+5 nt/m2
barie                   1e-1 nt/m2
barye                   1e-1 nt/m2
pieze                   1e+3 nt/m2

/ other
atmosphere              1.01325e+5 nt/m2
atm                     atmosphere
psi                     lb-g/in2
torr                    mm hg

/ ////////////////////////////////////////////////////////////
/ Energy and work (and power)

joule                   nt-m
watt                    joule/sec
W                       watt

cal                     4.1868 joule
calorie                 cal
kcal                    kilocal
kcalorie                kilocal
frigorie                kilocal

britishthermalunit      1.05506e+3 joule fuzz
btu                     britishthermalunit
erg                     cm2-gm/sec2
horsepower              550 ft-lb-g/sec
hp                      horsepower
therm                   1e+5 btu
thermie                 1e+6 cal
tnt                     4.6e+6 m2/sec2

/ ////////////////////////////////////////////////////////////
/ Temperature

degC                    K
kelvin                  K
degF                    5|9 degC
degreesrankine          degF
degrankine              degreesrankine
degreerankine           degF
degreaumur              10|8 degC

/ ////////////////////////////////////////////////////////////
/ Electrical

/ SI units
coulomb                 coul
C                       coul
ampere                  coul/sec
amp                     ampere
V                       volt
volt                    watt/amp
ohm                     volt/amp
farad                   coul/volt
henry                   sec2/farad
weber                   volt-sec
tesla                   weber/m2

/ special-case abbreviations
mh                      millihenry
uf                      microfarad
pf                      picofarad

/ other
biot                    10 amp
debye                   3.336e-30 coul-m
faraday                 9.652e+4 coul
gamma                   1e-9 weber/m2
gauss                   1e-4 weber/m2
gilbert                 7.95775e-1 amp
kilohm                  kiloohm
maxwell                 1e-8 weber
megohm                  megaohm
mho                     /ohm
oersted                 2.5e+2 pi-amp/m
oe                      oersted
siemens                 /ohm
statcoul                1|2.99792458e9 coul
statamp                 1|2.99792458e9 amp
statvolt                2.99792458e2 volt
statcoulomb             statcoul
statampere              statamp
/ franklin is an alternate name for statcoulomb
/ https://en.wikipedia.org/wiki/Franklin_(unit)
franklin                statcoul

/ ////////////////////////////////////////////////////////////
/ more energy

eV                      e V
ev                      e-volt
electronvolt            e-volt
bev                     1e+9 e-volt
kev                     1e+3 e-volt

rydberg                 1.36054e+1 ev

/ ////////////////////////////////////////////////////////////
/ Radiant intensity (and related phenomena)

/ SI units
cd                      candela
lumen                   cd sr
lux                     cd sr/m2

/ Miscellaneous units
apostilb                cd/pi-m2
blondel                 cd/pi-m2
candle                  1.02 candela
equivalentfootcandle    lumen/pi-ft2
equivalentlux           lumen/pi-m2
equivalentphot          cd/pi-cm2
footcandle              lumen/ft2
footlambert             cd/pi-ft2
hefnercandle            .92 cd
lambert                 cd/pi-cm2
nit                     cd/m2
nox                     1e-3 lux
phot                    lumen/cm2
skot                    1e-3 apostilb
stilb                   cd/cm2

langley                 cal/cm2

/ ////////////////////////////////////////////////////////////
/ Radioactivity and radiation dosimetry

/ Activity

becquerel               /sec
Bq                      becquerel
curie                   3.7e+10 /sec
Ci                      curie
rutherford              1e+6 /sec

/ Absorbed radiation dose

gray                    joule/kg
Gy                      gray
rad                     100 erg/gm

/ Equivalent radiation dose

sievert                 joule/kg
Sv                      sievert
rem                     1e-2 sievert

/ Legacy radiation dose

roentgen                2.58e-4 coulomb/kg
rontgen                 roentgen
R                       roentgen

/ ////////////////////////////////////////////////////////////
/ Currency

/ Wall Street Journal, July 2, 1993

$                       dollar
argentinapeso           $
australiadollar         .66 $
bahraindinar            2.6522 $
brazilcruzeiro          .000019 $
britainpound            1.49 $
canadadollar            .77 $
czechkoruna             .034 $
chilepeso               .0025 $
chinarenminbi           .174856 $
colombiapeso            .001495 $
denmarkkrone            .15 $
ecuadorsucre            .000539 $
europeeuro              0.9142 $
greatbritainpound       britainpound
hongkongdollar          .13 $
hungaryforint           .011 $
indiarupee              .03211 $
indonesiarupiah         .0004782 $
israelshekel            .3642 $
japanyen                .0093 $
jordandinar             1.4682 $
kuwaitdinar             3.3173 $
lebanonpound            .000578 $
malaysiaringgit         .338 $
maltalira               2.6042 $
mexicopeso              .3205128 $
newzealanddollar        .539 $
norwaykrone             .139 $
pakistanrupee           .037 $
perunewsol              .5065 $
philippinespeso         .03738 $
polandzloty             .000059 $
saudiarabiariyal        .26702 $
singaporedollar         .6157 $
slovakkoruna            .034 $
southafricarand         .21 $
southkoreawon           .001 $
swedenkrona             .13 $
switzerlandfranc        .66 $
taiwandollar            .038285 $
thailandbaht            .03962 $
turkeylira              .0000929 $
unitedarabdirham        .2723 $
uruguaynewpeso          .246852 $
venezuelabolivar        .011 $

/ The following currencies are locked to the Euro:
/ <URL:http://www.ecb.int/change/conversion.htm>
belgiumfranc            1|40.3399 euro
germanymark             1|1.95583 euro
spainpeseta             1|166.386 euro
francefranc             1|6.55957 euro
irelandpunt             1|.787564 euro
italylira               1|1936.27 euro
luxembourgfranc         1|40.3399 euro
netherlandsguilder      1|2.20371 euro
austriaschilling        1|13.7603 euro
portugalescudo          1|200.482 euro
finlandmarkka           1|5.94573 euro
greecedrachma           1|340.750 euro

mark                    germanymark
euro                    europeeuro
bolivar                 venezuelabolivar
peseta                  spainpeseta
rand                    southafricarand
escudo                  portugalescudo
newsol                  perunewsol
guilder                 netherlandsguilder
hollandguilder          netherlandsguilder
peso                    mexicopeso
yen                     japanyen
lira                    italylira
rupee                   indiarupee
drachma                 greecedrachma
franc                   francefranc
markka                  finlandmarkka
sucre                   ecuadorsucre
poundsterling           britainpound
cruzeiro                brazilcruzeiro

buck                    dollar
cent                    centidollar
fin                     5 dollar

/ ////////////////////////////////////////////////////////////
/ size of data

baud                    bit/sec
byte                    8 bit
block                   512 byte
kbyte                   1024 byte
megabyte                1024 kbyte
gigabyte                1024 megabyte
meg                     megabyte
gig                     gigabyte
terabyte                1024 gigabyte
petabyte                1024 terabyte


/ ////////////////////////////////////////////////////////////
/ Trivia and miscellaneous units

arpentcan               27.52 mi
arpentlin               191.835 ft
boardfoot               144 in3
bottommeasure           1|40 in
refrigeration           12000 btu/ton-hour
caratgold               1|24
ccs                     1|36 erlang
cfs                     ft3/sec
circularinch            1|4 pi-in2
circularmil             1e-6|4 pi-in2
clusec                  1e-8 mm-hg m3/s
crith                   9.06e-2 gm
diopter                 /m
displacementton         35 ft3
doppelzentner           100 kg
drop                    .03 cm3
galileo                 1e-2 m/sec2
imaginarycubicfoot      1.4 ft3
karat                   1|24
key                     kg
lusec                   1e-6 mm-hg m3/s
mgd                     megagal/day
minersinch              1.5 ft3/min
mpg                     mile/gal
poise                   gm/cm-sec
registerton             100 ft3
rhe                     10 m2/nt-sec
shippington             40 ft3
stoke                   1e-4 m2/sec
timberfoot              ft3
water                   gram g / cc
Xunit                   1.00202e-13 m

brewster                1e-12 m2/newton
poncelet                100 kg m g / sec
denier                  .05|450 gram / m
tex                     .001 gram / m
iudiptheria             62.8 microgram
iupenicillin            .6 microgram
iuinsulin               41.67 microgram
cottonyarncount         2520 ft/pound
linenyarncount          900 ft/pound
worstedyarncount        1680 ft/pound
metricyarncount         meter/gram
jewelerspoint           2 milligram