jcs's openbsd hax
openbsd
at jcs 777 lines 14 kB view raw
1/ $OpenBSD: units.lib,v 1.147 2023/04/12 15:26:26 jmc Exp $ 2/ $NetBSD: units.lib,v 1.3 1996/04/06 06:01:04 thorpej Exp $ 3 4/ primitive units 5m !a! 6kg !b! 7sec !c! 8coul !d! 9candela !e! 10dollar !f! 11bit !h! 12erlang !i! 13K !j! 14 15/ International System of Units (SI) prefixes 16quetta- 1e30 17ronna- 1e27 18yotta- 1e24 19zetta- 1e21 20exa- 1e18 21peta- 1e15 22tera- 1e12 23giga- 1e9 24mega- 1e6 25kilo- 1e3 26hecto- 1e2 27deca- 1e1 28deka- deca 29deci- 1e-1 30centi- 1e-2 31milli- 1e-3 32micro- 1e-6 33nano- 1e-9 34pico- 1e-12 35femto- 1e-15 36atto- 1e-18 37zepto- 1e-21 38yocto- 1e-24 39ronto- 1e-27 40quecto- 1e-30 41 42/ SI symbols 43Q- quetta 44R- ronna 45Y- yotta 46Z- zetta 47E- exa 48P- peta 49T- tera 50G- giga 51M- mega 52k- kilo 53h- hecto 54da- deca 55d- deci 56c- centi 57m- milli 58n- nano 59p- pico 60f- femto 61a- atto 62z- zepto 63y- yocto 64r- ronto 65q- quecto 66 67/ ISO/IEC 80000 binary prefixes 68yobi- 1208925819614629174706176 69zebi- 1180591620717411303424 70exbi- 1152921504606846976 71pebi- 1125899906842624 72tebi- 1099511627776 73gibi- 1073741824 74mebi- 1048576 75kibi- 1024 76 77/ ISO/IEC 80000 symbols 78Yi- yobi 79Zi- zebi 80Ei- exbi 81Pi- pebi 82Ti- tebi 83Gi- gibi 84Mi- mebi 85Ki- kibi 86 87/ Other prefixes 88myria- 1e4 89semi- .5 90demi- .5 91 92/ constants 93 94fuzz 1 95pi 3.14159265358979323846 96c 2.99792458e+8 m/sec 97g 9.80665 m/sec2 98bigG 6.67390e-11 m3/kg/s2 99AU 1.495978707e+11 m 100au AU 101mole 6.0221367e+23 fuzz 102e 1.60217733e-19 coul fuzz 103/ Next two to be multiplied by mass 104energy c2 105force g 106mercury 1.3332239e+5 kg/m2-sec2 107hg mercury 108mmHg 0.001 m hg 109 110mu 4.e-7 pi-N/A2 111epsilon 1.0 /mu/c2 112alpha 0.5 mu-c-e2/planck 113planck 6.6260755e-34 joule-sec 114hbar 0.5 planck/pi 115electronmass 9.1093897e-31 kg 116protonmass 1.6726231e-27 kg 117neutronmass 1.6749286e-27 kg 118 119 120/ dimensionless 121 122radian .5 / pi 123degree 1|180 pi-radian 124circle 2 pi-radian 125turn 2 pi-radian 126revolution turn 127rev turn 128grade .9 degree 129arcdeg 1 degree 130arcmin 1|60 arcdeg 131ccs 1|36 erlang 132arcsec 1|60 arcmin 133 134steradian radian2 135sphere 4 pi-steradian 136sr steradian 137 138/ Time 139 140second sec 141s sec 142minute 60 sec 143min minute 144hour 60 min 145hr hour 146day 24 hr 147da day 148week 7 day 149year 3.15569259747e7 sec fuzz 150yr year 151month 1|12 year 152ms millisec 153us microsec 154 155/ Mass 156 157gram millikg 158gm gram 159mg milligram 160metricton kilokg 161 162/ Avoirdupois 163 164lb .45359237 kg 165pound lb 166lbf lb g 167ounce 1|16 lb 168oz ounce 169dram 1|16 oz 170dr dram 171grain 1|7000 lb 172gr grain 173shortton 2000 lb 174ton shortton 175longton 2240 lb 176 177/ Apothecary 178 179scruple 20 grain 180apdram 60 grain 181apounce 480 grain 182appound 5760 grain 183troypound appound 184 185/ Length 186 187meter m 188micron micrometer 189angstrom decinanometer 190ao 0.25 alpha/pi/rydbergconst 191 192inch 2.54 cm 193in inch 194foot 12 in 195feet foot 196ft foot 197yard 3 ft 198yd yard 199rod 5.5 yd 200rd rod 201mile 5280 ft 202mi mile 203 204british 1200|3937 m/ft 205/ Assume we do not want the prefix n- with mile 206nmile 1852 m 207 208acre 4840 yd2 209 210ox acre/day 211 212cc cm3 213liter kilocc 214ml milliliter 215 216/ US Liquid 217 218gallon 231 in3 219imperial 1.20095 220gal gallon 221quart 1|4 gal 222qt quart 223pint 1|2 qt 224pt pint 225 226floz 1|16 pt 227fldr 1|8 floz 228 229/ US Dry 230 231dry 268.8025 in3/gallon fuzz 232peck 8 dry-quart 233pk peck 234bushel 4 peck 235bu bushel 236chaldron 36 bushel 237 238/ British 239 240brgallon 277.420 in3 fuzz 241brquart 1|4 brgallon 242brpint 1|2 brquart 243brfloz 1|20 brpint 244brpeck 554.84 in3 fuzz 245brbushel 4 brpeck 246 247/ Russian 248berkovets 10 pood 249pood 40 funt 250funt 0.40951 kg 251lot 1|32 funt 252zolotnik 1|3 lot 253dolya 1|96 zolotnik 254rumile 7 verst 255mezhevayaverst 2 verst 256verst 1066.8 m 257sazhen 1|500 verst 258kosayasazhen 1|430.2 verst 259arshin 1|1500 verst 260/ is not exactly defined 261ruell 16.54 in 262liniya 1|10 in 263vershok 1.75 in 264pyad 7 in 265vedro 12.3 liter 266shtoff 1|10 vedro 267vinebottle 1|16 vedro 268vodkabottle 1|20 vedro 269charka 1|100 vedro 270shkalik 1|200 vedro 271desyatina_state 109.3 are 272desyatina_farmery 0.75 desyatina_state 273sqverst 104.2 desyatina_state 274sqarshin 1|21600 desyatina_state 275 276/ Energy Work 277 278newton kg-m/sec2 279nt newton 280N newton 281joule nt-m 282J joule 283cal 4.1868 joule 284 285/ Electrical 286 287coulomb coul 288C coul 289ampere coul/sec 290amp ampere 291A amp 292watt joule/sec 293W watt 294volt watt/amp 295ohm volt/amp 296mho /ohm 297farad coul/volt 298F farad 299henry sec2/farad 300H henry 301weber volt-sec 302Wb weber 303 304/ Light 305 306cd candela 307lumen cd sr 308lux cd sr/m2 309 310/ http://www.federalreserve.gov/releases/h10/current/ 311/ as of April 23, 2021 312$ dollar 313australiadollar .7739 $ 314brazilreal 1|5.5011 $ 315canadadollar 1|1.2495 $ 316chinayuan 1|6.4945 $ 317denmarkkrone 1|6.1609 $ 318euro 1.2069 $ 319hongkongdollar 1|7.7605 $ 320indiarupee 1|74.9700 $ 321japanyen 1|107.9400 $ 322malaysiaringgit 1|4.1079 $ 323mexicopeso 1|19.8520 $ 324newzealanddollar .7179 $ 325norwaykrone 1|8.3125 $ 326singaporedollar 1|1.3275 $ 327southafricarand 1|14.2750 $ 328southkoreawon 1|1115.1000 $ 329srilankarupee 1|193.0000 $ 330swedenkrona 1|8.4030 $ 331switzerlandfranc 1|0.9152 $ 332taiwandollar 1|28.0900 $ 333thailandbaht 1|31.4100 $ 334unitedkingdompound 1.3845 $ 335venezuelabolivar 1|2500064.0890 $ 336 337/ The Economist, April 28, 2021 338/ Hungary, Iceland, Ukraine, Vietnam: no updates available since October 2018 339argentinapeso 1|93.4 $ 340chilepeso 1|702 $ 341colombiapeso 1|3707 $ 342czechkoruna 1|21.4 $ 343egyptpound 1|15.7 $ 344hungaryforint 1|276 $ 345icelandkrona 1|110 $ 346indonesiarupiah 1|14500 $ 347israelshekel 1|3.25 $ 348pakistanrupee 1|154 $ 349perunuevosol 1|3.82 $ 350philippinespeso 1|48.5 $ 351polandzloty 1|3.79 $ 352russiarouble 1|74.8 $ 353saudiarabiariyal 1|3.75 $ 354turkeylira 1|8.23 $ 355ukrainehryvnia 1|28.1 $ 356vietnamdong 1|23349 $ 357 358/ EMU currencies have constant exchange rate against Euro since 1.1.1999 359austriaschilling 1|13.7603 euro 360belgiumfranc 1|40.3399 euro 361cypruspound 1|0.585274 euro 362finlandmarkka 1|5.94573 euro 363francefranc 1|6.55957 euro 364germanymark 1|1.95583 euro 365greecedrachma 1|340.750 euro 366irelandpunt 1|0.787564 euro 367italylira 1|1936.27 euro 368luxembourgfranc 1|40.3399 euro 369maltalira 1|0.429300 euro 370netherlandsguilder 1|2.20371 euro 371portugalescudo 1|200.482 euro 372spainpeseta 1|166.386 euro 373slovakiakoruna 1|30.1260 euro 374sloveniatolar 1|239.640 euro 375 376/ currency aliases 377chinarenminbi chinayuan 378markka finlandmarkka 379franc francefranc 380mark germanymark 381drachma greecedrachma 382rupee indiarupee 383lira italylira 384yen japanyen 385peso mexicopeso 386guilder netherlandsguilder 387hollandguilder netherlandsguilder 388sol perunuevosol 389escudo portugalescudo 390rand southafricarand 391peseta spainpeseta 392britainpound unitedkingdompound 393greatbritainpound unitedkingdompound 394poundsterling unitedkingdompound 395bolivar venezuelabolivar 396 397/ ISO 4217 398ARS argentinapeso 399AUD australiadollar 400BRL brazilreal 401CAD canadadollar 402CHF switzerlandfranc 403CLP chilepeso 404CNY chinayuan 405COP colombiapeso 406CZK czechkoruna 407DKK denmarkkrone 408EGP egyptpound 409EUR euro 410GBP unitedkingdompound 411HKD hongkongdollar 412HUF hungaryforint 413IDR indonesiarupiah 414INR indiarupee 415ILS israelshekel 416ISK icelandkrona 417JPY japanyen 418KRW southkoreawon 419LKR srilankarupee 420MXN mexicopeso 421MYR malaysiaringgit 422NOK norwaykrone 423NZD newzealanddollar 424PEN perunuevosol 425PHP philippinespeso 426PKR pakistanrupee 427PLN polandzloty 428RUB russiarouble 429SAR saudiarabiariyal 430SEK swedenkrona 431SGD singaporedollar 432THB thailandbaht 433TRY turkeylira 434TWD taiwandollar 435UAH ukrainehryvnia 436USD dollar 437VEF venezuelabolivar 438VND vietnamdong 439ZAR southafricarand 440 441/ computer 442 443baud bit/sec 444byte 8 bit 445/ Not necessarily true on all systems! 446word 2 byte 447block 512 byte 448kbyte 1024 byte 449megabyte 1024 kbyte 450gigabyte 1024 megabyte 451meg megabyte 452 453/ Trivia 454 455% 1|100 456abampere 10 ampere 457admiraltyknot 6080 ft/hr 458apostilb cd/pi-m2 459asb apostilb 460are 1e+2 m2 461arpentcan 27.52 mi 462arpentlin 191.835 ft 463astronomicalunit AU 464atmosphere 1.01325e+5 nt/m2 465atm atmosphere 466atomicmassunit 1.6605402e-27 kg fuzz 467amu atomicmassunit 468bag 94 lb 469bakersdozen 13 470bar 1e+5 nt/m2 471barie 1e-1 nt/m2 472barleycorn 1|3 in 473barn 1e-28 m2 474/ oil barrel, nothing else 475barrel 42 gal 476barye 1e-1 nt/m2 477baryl microbar 478becquerel /s 479bev 1e+9 e-volt 480biot 10 amp 481blondel cd/pi-m2 482boardfoot 144 in3 483/ Defn of bolt is also an area, but depends on type of cloth 484bolt 40 yd 485bottommeasure 1|40 in 486Bq becquerel 487britishthermalunit 1.05506e+3 joule fuzz 488btu britishthermalunit 489refrigeration 12000 btu/ton-hour 490buck dollar 491cable 720 ft 492caliber 1e-2 in 493calorie cal 494carat 205 mg 495caratgold 1|24 496cent centidollar 497cental 100 lb 498centesimalminute 1e-2 grade 499centesimalsecond 1e-4 grade 500century 100 year 501cfs ft3/sec 502chain 66 ft 503Ci curie 504circularinch 1|4 pi-in2 505circularmil 1e-6|4 pi-in2 506clusec 1e-8 mm-hg m3/s 507coomb 4 bu 508cord 128 ft3 509cordfoot cord 510crith 9.06e-2 gm 511cubit 18 in 512cup 1|2 pt 513curie 3.7e+10 /sec 514dalton amu 515decade 10 yr 516diopter dioptre 517dioptre /m 518displacementton 35 ft3 519doppelzentner 100 kg 520dozen 12 521drop .03 cm3 522dyne cm-gm/sec2 523electronvolt e-volt 524ell 45 in 525engineerschain 100 ft 526engineerslink 100|100 ft 527equivalentfootcandle lumen/pi-ft2 528equivalentlux lumen/pi-m2 529equivalentphot cd/pi-cm2 530erg cm2-gm/sec2 531ev e-volt 532faraday 9.6485309e+4 coul 533fathom 6 ft 534fermi 1e-15 m 535fifth 4|5 qt 536fin 5 dollar 537finger 7|8 in 538firkin 9 gal 539footcandle lumen/ft2 540footlambert cd/pi-ft2 541fortnight 14 da 542franklin 3.33564e-10 coul 543frigorie kilocal 544furlong 220 yd 545galileo 1e-2 m/sec2 546gamma 1e-9 weber/m2 547gauss 1e-4 weber/m2 548G gauss 549geodeticfoot british-ft 550geographicalmile 1852 m 551gilbert 2.5 amp/pi 552gill 1|4 pt 553gray J/kg 554gross 144 555gunterschain 22 yd 556Gy gray 557hand 4 in 558hartree 2 rydberg 559hectare 1e+4 m2 560hefnercandle .92 cd 561hertz /sec 562Hz hertz 563hogshead 2 barrel 564hd hogshead 565homestead 1|4 mi2 566/ horsepower is not uniquely defined 567horsepower 735.50 watt 568hp horsepower 569hubble 1e9 ly 570hyl gm force sec2/m 571hz /sec 572imaginarycubicfoot 1.4 ft3 573jansky 1e-26 W/m2-Hz 574jeroboam 4|5 gal 575Jy jansky 576karat 1|24 577kayser /cm 578kcal kilocal 579kcalorie kilocal 580key kg 581kilderkin 18 gal 582knot nmile/hr 583kn knot 584lambert cd/pi-cm2 585Lb lambert 586langley cal/cm2 587last 80 bu 588league 3 mi 589lightyear c-yr 590ly lightyear 591line 1|12 in 592link 66|100 ft 593longhundredweight 112 lb 594longquarter 28 lb 595lusec 1e-6 mm-hg m3/s 596m_earth 5.97223e24 kg 597m_moon 7.34e22 kg 598m_sun 1.98843e30 kg 599mach 331.46 m/sec 600magnum 2 qt 601marineleague 3 nmile 602maxwell 1e-8 weber 603Mx maxwell 604metriccarat 200 mg 605mgd megagal/day 606mh millihenry 607mil 1e-3 in 608millennium 1000 year 609minersinch 1.5 ft3/min 610minim 1|60 fldr 611mo month 612mpg mile/gal 613mph mile/hr 614nail 1|16 yd 615nauticalmile nmile 616nit cd/m2 617noggin 1|8 qt 618nox 1e-3 lux 619ns nanosec 620oersted 2.5e+2 amp/m/pi 621Oe oersted 622pace 36 in 623palm 3 in 624pair 2 625parasang 3.5 mi 626parsec AU-radian/arcsec 627pascal nt/m2 628Pa pascal 629pc parsec 630pennyweight 1|20 oz 631pwt pennyweight 632percent % 633perch rd 634phot lumen/cm2 635pica 1|6 in 636pieze 1e+3 nt/m2 637pipe 4 barrel 638point 1|72 in 639poise gm/cm-sec 640P poise 641pole rd 642pond 9.80665e-3 nt 643poundal ft-lb/sec2 644pdl poundal 645proof 1|200 646psi lb-g/in2 647quarter 9 in 648quartersection 1|4 mi2 649quintal 100 kg 650quire 25 651r_earth 6378.1370 km 652r_moon 0.2725076 r_earth 653rackunit 1.75 in 654rad 100 erg/gm 655ream 500 656registerton 100 ft3 657rehoboam 156 floz 658rhe 10 m2/nt-sec 659rem 0.01 J/kg 660rontgen 2.58e-4 curie/kg 661roentgen rontgen 662R roentgen 663rood 1.21e+3 yd 664rope 20 ft 665RU rackunit 666rutherford 1e+6 /sec 667rydbergconst 0.5 electronmass-c-alpha2/planck 668rydberg rydbergconst-planck-c 669sabin 1 ft2 670sack 3 bu 671score 20 672seam 8 bu 673section mi2 674shippington 40 ft3 675shorthundredweight 100 lb 676shortquarter 25 lb 677siemens /ohm 678sievert J/kg 679sigma microsec 680skein 120 yd 681skot 1e-3 apostilb 682slug lb-g-sec2/ft 683smoot 67 in 684span 9 in 685spat 4 pi sr 686spindle 14400 yd 687square 100 ft2 688stere m3 689sthene 1e+3 nt 690stilb cd/cm2 691sb stilb 692stoke 1e-4 m2/sec 693stone 14 lb 694strike 2 bu 695surveyfoot british-ft 696surveyyard 3 surveyfoot 697surveyorschain 66 ft 698surveyorslink 66|100 ft 699Sv sievert 700tablespoon 4 fldr 701teaspoon 4|3 fldr 702tesla weber/m2 703T tesla 704therm 1e+5 btu 705thermie 1e+6 cal 706timberfoot ft3 707tnt 4.6e+6 m2/sec2 708tonne 1e+6 gm 709torr mm hg 710township 36 mi2 711tun 8 barrel 712water gram g / cc 713/ pumps are often in "feet head", assuming feet of water 714head water 715wey 40 bu 716weymass 252 lb 717Xunit 1.00206e-13 m 718k 1.38047e-16 erg/degC 719 720 721degC K 722kelvin K 723brewster 1e-12 m2/newton 724degF 5|9 degC 725degreesrankine degF 726degrankine degreesrankine 727degreerankine degF 728degreaumur 10|8 degC 729drachm 60 grain 730poncelet 100 kg m g / sec 731denier .05|450 gram / m 732tex .001 gram / m 733englishell 45 inch 734scottishell 37.2 inch 735flemishell 27 inch 736V volt 737eV ev 738bohrradius ao 739fresnel 1e12 hertz 740statcoul 1|2.99792458e9 coul 741statamp 1|2.99792458e9 amp 742statvolt 2.99792458e2 volt 743statcoulomb statcoul 744statampere statamp 745debye 3.33564e-30 coul-m 746pulsatance 2 pi/sec 747rpm rev/minute 748rps rev/sec 749kilohm kiloohm 750megohm megaohm 751siderealyear 365.256360417 day 752siderealday 23.934469444 hour 753siderealhour 1|24 siderealday 754lunarmonth 29.5305555 day 755synodicmonth lunarmonth 756siderealmonth 27.32152777 day 757tropicalyear year 758solaryear year 759lunaryear 12 lunarmonth 760cran 37.5 brgallon 761kip 1000 lbf 762frenchfoot 16|15 ft 763frenchfeet frenchfoot 764toise 6 frenchfeet 765candle 1.02 candela 766militarypace 2.5 feet 767metre meter 768litre liter 769gramme gram 770iudiptheria 62.8 microgram 771iupenicillin .6 microgram 772iuinsulin 41.67 microgram 773cottonyarncount 2520 ft/pound 774linenyarncount 900 ft/pound 775worstedyarncount 1680 ft/pound 776metricyarncount meter/gram 777jewlerspoint 2 milligram