summaryrefslogtreecommitdiff
path: root/usr.bin/units/units.lib
blob: a7c453bd76dcb77302c0a737b3977199c1cca81f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
/ $OpenBSD: units.lib,v 1.55 2013/10/01 05:49:41 jmc Exp $
/ $NetBSD: units.lib,v 1.3 1996/04/06 06:01:04 thorpej Exp $

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

/ International System of Units (SI) prefixes
yotta-			1e24
zetta-			1e21
exa-			1e18
peta-			1e15
tera-			1e12
giga-			1e9
mega-			1e6
kilo-			1e3
hecto-			1e2
deca-			1e1
deka-			deca
deci-			1e-1
centi-			1e-2
milli-			1e-3
micro-			1e-6
nano-			1e-9
pico-			1e-12
femto-			1e-15
atto-			1e-18
zepto-			1e-21
yocto-			1e-24

/ SI symbols
Y-			yotta
Z-			zetta
E-			exa
P-			peta
T-			tera
G-			giga
M-			mega
k-			kilo
h-			hecto
da-			deca
d-			deci
c-			centi
m-			milli
n-			nano
p-			pico
f-			femto
a-			atto
z-			zepto
y-			yocto

/ ISO/IEC 80000 binary prefixes
yobi-			1208925819614629174706176
zebi-			1180591620717411303424
exbi-			1152921504606846976
pebi-			1125899906842624
tebi-			1099511627776
gibi-			1073741824
mebi-			1048576
kibi-			1024

/ ISO/IEC 80000 symbols
Yi-			yobi
Zi-			zebi
Ei-			exbi
Pi-			pebi
Ti-			tebi
Gi-			gibi
Mi-			mebi
Ki-			kibi

/ Other prefixes
myria-			1e4
semi-			.5
demi-			.5

/ constants

fuzz			1
pi			3.14159265358979323846
c			2.99792458e+8 m/sec
g			9.80665 m/sec2
bigG			6.67390e-11 m3/kg/s2
AU			1.495978707e+11 m
au			AU
mole			6.0221367e+23 fuzz
e			1.60217733e-19 coul fuzz
/ Next two to be multiplied by mass
energy			c2
force			g
mercury			1.3332239e+5 kg/m2-sec2
hg			mercury
mmHg			0.001 m hg

mu			4.e-7 pi-N/A2
epsilon			1.0 /mu/c2
alpha			0.5 mu-c-e2/planck
planck			6.6260755e-34 joule-sec
hbar			0.5 planck/pi
electronmass		9.1093897e-31 kg
protonmass		1.6726231e-27 kg
neutronmass		1.6749286e-27 kg


/ dimensionless

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
ccs			1|36 erlang
arcsec			1|60 arcmin

steradian		radian2
sphere			4 pi-steradian
sr			steradian

/ Time

second			sec
s			sec
minute			60 sec
min			minute
hour			60 min
hr			hour
day			24 hr
da			day
week			7 day
year			3.15569259747e7 sec fuzz
yr			year
month			1|12 year
ms			millisec
us			microsec

/ Mass

gram			millikg
gm			gram
mg			milligram
metricton		kilokg

/ Avoirdupois

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
shortton		2000 lb
ton			shortton
longton			2240 lb

/ Apothecary

scruple			20 grain
apdram			60 grain
apounce			480 grain
appound			5760 grain
troypound		appound

/ Length

meter			m
micron			micrometer
angstrom		decinanometer
ao			0.25 alpha/pi/rydbergconst

inch			2.54 cm
in			inch
foot			12 in
feet			foot
ft			foot
yard			3 ft
yd			yard
rod			5.5 yd
rd			rod
mile			5280 ft
mi			mile

british			1200|3937 m/ft
/ Assume we do not want the prefix n- with mile
nmile			1852 m

acre			4840 yd2

ox			acre/day

cc			cm3
liter			kilocc
ml			milliliter

/ US Liquid

gallon			231 in3
imperial		1.20095
gal			gallon
quart			1|4 gal
qt			quart
pint			1|2 qt
pt			pint

floz			1|16 pt
fldr			1|8 floz

/ US Dry

dry			268.8025 in3/gallon fuzz
peck			8 dry-quart
pk			peck
bushel			4 peck
bu			bushel
chaldron		36 bushel

/ British

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

/ Russian
berkovets		10 pood
pood			40 funt
funt			0.40951 kg
lot			1|32 funt
zolotnik		1|3 lot
dolya			1|96 zolotnik
rumile			7 verst
mezhevayaverst		2 verst
verst			1066.8 m
sazhen			1|500 verst
kosayasazhen		1|430.2 verst
arshin			1|1500 verst
/ is not exactly defined
ruell			16.54 in
liniya			1|10 in
vershok			1.75 in
pyad			7 in
vedro			12.3 liter
shtoff			1|10 vedro
vinebottle		1|16 vedro
vodkabottle		1|20 vedro
charka			1|100 vedro
shkalik			1|200 vedro
desyatina_state		109.3 are
desyatina_farmery	0.75 desyatina_state
sqverst			104.2 desyatina_state
sqarshin		1|21600 desyatina_state

/ Energy Work

newton			kg-m/sec2
nt			newton
N			newton
joule			nt-m
J			joule
cal			4.1868 joule

/ Electrical

coulomb			coul
C			coul
ampere			coul/sec
amp			ampere
A			amp
watt			joule/sec
W			watt
volt			watt/amp
ohm			volt/amp
mho			/ohm
farad			coul/volt
F			farad
henry			sec2/farad
H			henry
weber			volt-sec
Wb			weber

/ Light

cd			candela
lumen			cd sr
lux			cd sr/m2

/ http://www.federalreserve.gov/releases/h10/current/
/ as of September 20, 2013
$			dollar
australiadollar		.9397 $
brazilreal		1|2.2047 $
canadadollar		1|1.0287 $
chinayuan		1|6.1210 $
denmarkkrone		1|5.5150 $
euro			1.3522 $
hongkongdollar		1|7.7533  $
indiarupee		1|62.2700 $
japanyen		1|99.3800 $
malaysiaringgit		1|3.1640 $
mexicopeso		1|12.7770 $
newzealanddollar	.8372 $
norwaykrone		1|5.9184 $
singaporedollar		1|1.2510 $
southafricarand		1|9.8650 $
southkoreawon		1|1076.0200 $
srilankarupee		1|132.1000 $
swedenkrona		1|6.3615 $
switzerlandfranc	1|0.9104 $
taiwandollar		1|29.5600 $
thailandbaht		1|31.0400 $
unitedkingdompound	1.6021 $
venezuelabolivar	1|6.2842 $

/ The Economist, September 25, 2013
argentinapeso		1|5.77 $
chilepeso		1|501 $
colombiapeso		1|1896 $
czechkoruna		1|19.1 $
egyptpound		1|6.89 $
hungaryforint		1|222 $
icelandkrona		1|122 $
indonesiarupiah		1|11485 $
israelshekel		1|3.56 $
latvialats		1|0.52 $
lithuanialitas		1|2.56 $
pakistanrupee		1|106 $
perunuevosol		1|2.77 $
philippinespeso		1|43.4 $
polandzloty		1|3.12 $
russiarouble		1|32.1 $
saudiarabiariyal	1|3.75 $
turkeylira		1|2.01 $
ukrainehryvnia		1|8.18 $
vietnamdong		1|21120 $

/ EMU currencies have constant exchange rate against Euro since 1.1.1999
austriaschilling	1|13.7603 euro
belgiumfranc		1|40.3399 euro
cypruspound		1|0.585274 euro
finlandmarkka		1|5.94573 euro
francefranc		1|6.55957 euro
germanymark		1|1.95583 euro
greecedrachma		1|340.750 euro
irelandpunt		1|0.787564 euro
italylira		1|1936.27 euro
luxembourgfranc		1|40.3399 euro
maltalira		1|0.429300 euro
netherlandsguilder	1|2.20371 euro
portugalescudo		1|200.482 euro
spainpeseta		1|166.386 euro
slovakiakoruna		1|30.1260 euro
sloveniatolar		1|239.640 euro

/ currency aliases
chinarenminbi		chinayuan
markka			finlandmarkka
franc			francefranc
mark			germanymark
drachma			greecedrachma
rupee			indiarupee
lira			italylira
yen			japanyen
peso			mexicopeso
guilder			netherlandsguilder
hollandguilder		netherlandsguilder
sol			perunuevosol
escudo			portugalescudo
rand			southafricarand
peseta			spainpeseta
britainpound		unitedkingdompound
greatbritainpound	unitedkingdompound
poundsterling		unitedkingdompound
bolivar			venezuelabolivar

/ ISO 4217
ARS			argentinapeso
AUD			australiadollar
BRL			brazilreal
CAD			canadadollar
CHF			switzerlandfranc
CLP			chilepeso
CNY			chinayuan
COP			colombiapeso
CZK			czechkoruna
DKK			denmarkkrone
EGP			egyptpound
EUR			euro
GBP			unitedkingdompound
HKD			hongkongdollar
HUF			hungaryforint
IDR			indonesiarupiah
INR			indiarupee
ILS			israelshekel
ISK			icelandkrona
JPY			japanyen
KRW			southkoreawon
LKR			srilankarupee
LTL			lithuanialitas
LVL			latvialats
MXN			mexicopeso
MYR			malaysiaringgit
NOK			norwaykrone
NZD			newzealanddollar
PEN			perunuevosol
PHP			philippinespeso
PKR			pakistanrupee
PLN			polandzloty
RUB			russiarouble
SAR			saudiarabiariyal
SEK			swedenkrona
SGD			singaporedollar
THB			thailandbaht
TRY			turkeylira
TWD			taiwandollar
UAH			ukrainehryvnia
USD			dollar
VEF			venezuelabolivar
VND			vietnamdong
ZAR			southafricarand

/ computer

baud			bit/sec
byte			8 bit
/ Not necessarily true on all systems!
word			2 byte
block			512 byte
kbyte			1024 byte
megabyte		1024 kbyte
gigabyte		1024 megabyte
meg			megabyte

/ Trivia

%			1|100
abampere		10 ampere
admiraltyknot		6080 ft/hr
apostilb		cd/pi-m2
asb			apostilb
are			1e+2 m2
arpentcan		27.52 mi
arpentlin		191.835 ft
astronomicalunit	AU
atmosphere		1.01325e+5 nt/m2
atm			atmosphere
atomicmassunit		1.6605402e-27 kg fuzz
amu			atomicmassunit
bag			94 lb
bakersdozen		13
bar			1e+5 nt/m2
barie			1e-1 nt/m2
barleycorn		1|3 in
barn			1e-28 m2
/ oil barrel, nothing else
barrel			42 gal
barye			1e-1 nt/m2
baryl			microbar
becquerel		/s
bev			1e+9 e-volt
biot			10 amp
blondel			cd/pi-m2
boardfoot		144 in3
/ Defn of bolt is also an area, but depends on type of cloth
bolt			40 yd
bottommeasure		1|40 in
Bq			becquerel
britishthermalunit	1.05506e+3 joule fuzz
btu			britishthermalunit
refrigeration		12000 btu/ton-hour
buck			dollar
cable			720 ft
caliber			1e-2 in
calorie			cal
carat			205 mg
caratgold		1|24
cent			centidollar
cental			100 lb
centesimalminute	1e-2 grade
centesimalsecond	1e-4 grade
century			100 year
cfs			ft3/sec
chain			66 ft
Ci			curie
circularinch		1|4 pi-in2
circularmil		1e-6|4 pi-in2
clusec			1e-8 mm-hg m3/s
coomb			4 bu
cord			128 ft3
cordfoot		cord
crith			9.06e-2 gm
cubit			18 in
cup			1|2 pt
curie			3.7e+10 /sec
dalton			amu
decade			10 yr
diopter			dioptre
dioptre			/m
displacementton		35 ft3
doppelzentner		100 kg
dozen			12
drop			.03 cm3
dyne			cm-gm/sec2
electronvolt		e-volt
ell			45 in
engineerschain		100 ft
engineerslink		100|100 ft
equivalentfootcandle	lumen/pi-ft2
equivalentlux		lumen/pi-m2
equivalentphot		cd/pi-cm2
erg			cm2-gm/sec2
ev			e-volt
faraday			9.6485309e+4 coul
fathom			6 ft
fermi			1e-15 m
fifth			4|5 qt
fin			5 dollar
finger			7|8 in
firkin			9 gal
footcandle		lumen/ft2
footlambert		cd/pi-ft2
fortnight		14 da
franklin		3.33564e-10 coul
frigorie		kilocal
furlong			220 yd
galileo			1e-2 m/sec2
gamma			1e-9 weber/m2
gauss			1e-4 weber/m2
G			gauss
geodeticfoot		british-ft
geographicalmile	1852 m
gilbert			2.5 amp/pi
gill			1|4 pt
gray			J/kg
gross			144
gunterschain		22 yd
Gy			gray
hand			4 in
hartree			2 rydberg
hectare			1e+4 m2
hefnercandle		.92 cd
hertz			/sec
Hz			hertz
hogshead		2 barrel
hd			hogshead
homestead		1|4 mi2
/ horsepower is not uniquely defined
horsepower		735.50 watt
hp			horsepower
hubble			1e9 ly
hyl			gm force sec2/m
hz			/sec
imaginarycubicfoot	1.4 ft3
jansky			1e-26 W/m2-Hz
jeroboam		4|5 gal
Jy			jansky
karat			1|24
kayser			/cm
kcal			kilocal
kcalorie		kilocal
key			kg
kilderkin		18 gal
knot			nmile/hr
kn			knot
lambert			cd/pi-cm2
Lb			lambert
langley			cal/cm2
last			80 bu
league			3 mi
lightyear		c-yr
ly			lightyear
line			1|12 in
link			66|100 ft
longhundredweight	112 lb
longquarter		28 lb
lusec			1e-6 mm-hg m3/s
m_earth			5.97223e24 kg
m_moon			7.34e22 kg
m_sun			1.98843e30 kg
mach			331.46 m/sec
magnum			2 qt
marineleague		3 nmile
maxwell			1e-8 weber
Mx			maxwell
metriccarat		200 mg
mgd			megagal/day
mh			millihenry
mil			1e-3 in
millennium		1000 year
minersinch		1.5 ft3/min
minim			1|60 fldr
mo			month
mpg			mile/gal
mph			mile/hr
nail			1|16 yd
nauticalmile		nmile
nit			cd/m2
noggin			1|8 qt
nox			1e-3 lux
ns			nanosec
oersted			2.5e+2 amp/m/pi
Oe			oersted
pace			36 in
palm			3 in
pair			2
parasang		3.5 mi
parsec			AU-radian/arcsec
pascal			nt/m2
Pa			pascal
pc			parsec
pennyweight		1|20 oz
pwt			pennyweight
percent			%
perch			rd
phot			lumen/cm2
pica			1|6 in
pieze			1e+3 nt/m2
pipe			4 barrel
point			1|72 in
poise			gm/cm-sec
P			poise
pole			rd
pond			9.80665e-3 nt
poundal			ft-lb/sec2
pdl			poundal
proof			1|200
psi			lb-g/in2
quarter			9 in
quartersection		1|4 mi2
quintal			100 kg
quire			25
r_earth			6378.1370 km
r_moon			0.2725076 r_earth
rackunit		1.75 in
rad			100 erg/gm
ream			500
registerton		100 ft3
rehoboam		156 floz
rhe			10 m2/nt-sec
rem			0.01 J/kg
rontgen			2.58e-4 curie/kg
roentgen		rontgen
R			roentgen
rood			1.21e+3 yd
rope			20 ft
RU			rackunit
rutherford		1e+6 /sec
rydbergconst		0.5 electronmass-c-alpha2/planck
rydberg			rydbergconst-planck-c
sabin			1 ft2
sack			3 bu
score			20
seam			8 bu
section			mi2
shippington		40 ft3
shorthundredweight	100 lb
shortquarter		25 lb
siemens			/ohm
sievert			J/kg
sigma			microsec
skein			120 yd
skot			1e-3 apostilb
slug			lb-g-sec2/ft
smoot			67 in
span			9 in
spat			4 pi sr
spindle			14400 yd
square			100 ft2
stere			m3
sthene			1e+3 nt
stilb			cd/cm2
sb			stilb
stoke			1e-4 m2/sec
stone			14 lb
strike			2 bu
surveyfoot		british-ft
surveyyard		3 surveyfoot
surveyorschain		66 ft
surveyorslink		66|100 ft
Sv			sievert	   
tablespoon		4 fldr
teaspoon		4|3 fldr
tesla			weber/m2
T			tesla
therm			1e+5 btu
thermie			1e+6 cal
timberfoot		ft3
tnt			4.6e+6 m2/sec2
tonne			1e+6 gm
torr			mm hg
township		36 mi2
tun			8 barrel
water			gram g / cc
/ pumps are often in "feet head", assuming feet of water
head			water
wey			40 bu
weymass			252 lb
Xunit			1.00206e-13 m
k			1.38047e-16 erg/degC


degC			K
kelvin			K
brewster		1e-12 m2/newton
degF			5|9 degC
degreesrankine		degF
degrankine		degreesrankine
degreerankine		degF
degreaumur		10|8 degC
drachm			60 grain
poncelet		100 kg m g / sec
denier			.05|450 gram / m
tex			.001 gram / m
englishell		45 inch
scottishell		37.2 inch
flemishell		27 inch
V			volt
eV			ev
bohrradius		ao
fresnel			1e12 hertz
statcoul		1|2.99792458e9 coul
statamp			1|2.99792458e9 amp
statvolt		2.99792458e2 volt
statcoulomb		statcoul
statampere		statamp
debye			3.33564e-30 coul-m
pulsatance		2 pi/sec
rpm			rev/minute
rps			rev/sec
kilohm			kiloohm
megohm			megaohm
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
cran			37.5 brgallon
kip			1000 lbf
frenchfoot		16|15 ft
frenchfeet		frenchfoot
toise			6 frenchfeet
candle			1.02 candela
militarypace		2.5 feet
metre			meter
litre			liter
gramme			gram
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
jewlerspoint		2 milligram