units.lib revision 1.29
1/ $NetBSD: units.lib,v 1.29 2022/10/24 05:52:48 dholland Exp $ 2 3/ primitive units 4 5m !a! 6kg !b! 7sec !c! 8coul !d! 9candela !e! 10dollar !f! 11bit !h! 12erlang !i! 13K !j! 14 15/ prefixes 16 17yotta- 1e24 18zetta- 1e21 19exa- 1e18 20peta- 1e15 21tera- 1e12 22giga- 1e9 23mega- 1e6 24myria- 1e4 25kilo- 1e3 26hecto- 1e2 27deka- 1e1 28deci- 1e-1 29centi- 1e-2 30milli- 1e-3 31micro- 1e-6 32nano- 1e-9 33pico- 1e-12 34femto- 1e-15 35atto- 1e-18 36zopto- 1e-21 37yocto- 1e-24 38 39semi- .5 40demi- .5 41 42Y- yotta 43Z- zetta 44E- exa 45P- peta 46T- tera 47G- giga 48M- mega 49k- kilo 50h- hecto 51da- deka 52d- deci 53c- centi 54m- milli 55p- pico 56f- femto 57a- atto 58z- zopto 59y- yocto 60 61/ //////////////////////////////////////////////////////////// 62/ constants 63 64fuzz 1 65 66pi 3.14159265358979323846 67c 2.99792458e+8 m/sec fuzz 68e 1.6021917e-19 coul fuzz 69k 1.38047e-16 erg/degC 70planck 6.626e-34 joule-sec 71hbar 1.055e-34 joule-sec 72mole 6.022169e+23 fuzz 73 74g 9.80665 m/sec2 75 76/ conversion factors used as adjectives 77energy c2 78force g 79mercury 1.33322e+5 kg/m2-sec2 80hg mercury 81 82/ standard ratios 83% 1|100 84percent % 85/ proof is specific to alcohol concentration 86proof 1|200 87 88/ //////////////////////////////////////////////////////////// 89/ counts 90 91dozen 12 92bakersdozen 13 93score 20 94gross 144 95 96/ quire and ream are specific to counting sheets of paper 97quire 25 98ream 500 99 100/ //////////////////////////////////////////////////////////// 101/ angles 102 103radian .5 / pi 104degree 1|180 pi-radian 105circle 2 pi-radian 106turn 2 pi-radian 107revolution turn 108rev turn 109grade .9 degree 110arcdeg 1 degree 111arcmin 1|60 arcdeg 112arcsec 1|60 arcmin 113 114centesimalminute 1e-2 grade 115centesimalsecond 1e-4 grade 116 117/ //////////////////////////////////////////////////////////// 118/ solid angles 119 120steradian radian2 121sphere 4 pi-steradian 122sr steradian 123spat 4 pi sr 124 125/ //////////////////////////////////////////////////////////// 126/ Time 127 128/ SI unit 129second sec 130s sec 131 132/ special-case abbreviations 133ms millisec 134ns nanosec 135us microsec 136 137/ civil timekeeping 138minute 60 sec 139min minute 140hour 60 min 141hr hour 142day 24 hr 143da day 144week 7 day 145fortnight 14 da 146month 1|12 year 147mo month 148year 365.24219879 day fuzz 149yr year 150decade 10 yr 151century 100 year 152millennium 1000 year 153 154/ astronomical details 155siderealyear 365.256360417 day 156siderealday 23.934469444 hour 157siderealhour 1|24 siderealday 158lunarmonth 29.5305555 day 159synodicmonth lunarmonth 160siderealmonth 27.32152777 day 161tropicalyear year 162solaryear year 163lunaryear 12 lunarmonth 164 165/ misc 166sigma microsec 167 168/ //////////////////////////////////////////////////////////// 169/ Frequency 170 171hertz /sec 172Hz hertz 173hz /sec 174khz 1e+3 /sec 175mhz 1e+6 /sec 176rpm rev/minute 177rps rev/sec 178 179fresnel 1e12 hertz 180pulsatance 2 pi/sec 181 182/ //////////////////////////////////////////////////////////// 183/ Mass and weight 184 185gram millikg 186gramme gram 187gm gram 188mg milligram 189metricton kilokg 190tonne 1e+6 gm 191 192atomicmassunit 1.66044e-27 kg fuzz 193amu atomicmassunit 194dalton amu 195 196electronmass 9.1095e-31 kg 197protonmass 1.6726e-27 kg 198neutronmass 1.6606e-27 kg 199 200carat 205 mg 201metriccarat 200 mg 202quintal 100 kg 203 204/ Avoirdupois weight 205 206lb .45359237 kg 207pound lb 208ounce 1|16 lb 209oz ounce 210dram 1|16 oz 211dr dram 212grain 1|7000 lb 213gr grain 214stone 14 lb 215shortton 2000 lb 216ton shortton 217longton 2240 lb 218 219bag 94 lb 220cental 100 lb 221longhundredweight 112 lb 222longquarter 28 lb 223pennyweight 1|20 oz 224pwt pennyweight 225shorthundredweight 100 lb 226shortquarter 25 lb 227weymass 252 lb 228 229/ Related mass units 230/ 231/ According to Wikipedia there are two definitions for hyl, one using 232/ grams and one using kilograms. beware 233 234hyl gm force sec2/m 235slug lb-g-sec2/ft 236 237/ Apothecary weight 238 239scruple 20 grain 240apdram 60 grain 241drachm 60 grain 242apounce 480 grain 243appound 5760 grain 244troypound appound 245troyounce 1|12 troypound 246 247/ Thai weight 248 249salueng 3.75 gm 250baht 4 salueng 251tamlueng 4 baht 252chang 20 tamlueng 253hap 50 chang 254 255/ //////////////////////////////////////////////////////////// 256/ Length 257 258/ SI unit 259meter m 260metre meter 261 262/ special-case abbreviations 263cm centimeter 264mm millimeter 265km kilometer 266nm nanometer 267 268/ other metric units 269angstrom decinanometer 270fermi 1e-15 m 271micron micrometer 272 273/ space-sized lengths 274au 1.49597871e+11 m fuzz 275astronomicalunit au 276lightyear c-yr 277parsec au-radian/arcsec 278pc parsec 279 280/ English system lengths 281inch 2.54 cm 282in inch 283foot 12 in 284feet foot 285ft foot 286yard 3 ft 287yd yard 288mile 5280 ft 289mi mile 290league 3 mi 291mil 1e-3 in 292 293/ nautical 294/ 295/ Historically, the nautical mile was 6080 feet (6080.2 in England) 296/ but was changed to 1852 meters (6076 feet and change) in the 20th 297/ century with varying dates of adoption around the world. 298/ https://en.wikipedia.org/wiki/Nautical_mile 299/ 300/ The US cable is 720 feet. The international cable is 1/10 nautical 301/ mile, which is substantially shorter. The UK Admiralty cable is 302/ apparently 1/10 of a historical Admiralty nautical mile, which is 303/ 1853.2 instead of 1852 meters. These definitions date from the 20th 304/ century. Historically, a cable was 100 fathoms, but the fathom 305/ hadn't yet been fixed at 6 feet, so cables weren't a fixed length 306/ either. 307/ https://en.wikipedia.org/wiki/Cable_(unit) 308/ 309fathom 6 ft 310nmile 1852 m 311nauticalmile nmile 312marineleague 3 nmile 313cable 1|10 nmile 314uscable 720 ft 315admiraltycable 185.32 m 316 317/ surveying 318/ 319/ The US survey foot is defined as 1200/3937 meters, as opposed to the 320/ ordinary international foot, which is 0.3048 meter (that's exactly 321/ 2.54 cm to the inch as defined above.) These differ slightly. 322/ https://en.wikipedia.org/wiki/Foot_(unit) 323/ 324/ In the US, rods, chains, and furlongs are defined in terms of survey 325/ feet, though the Wikipedia page on furlongs claims without citation 326/ that some states use one definition and some the other. However, it 327/ appears that as of 2022 this definition is on the way out, and other 328/ jurisdictions define these units (to the extent they're used at all) 329/ in terms of the international foot. 330/ https://en.wikipedia.org/wiki/Rod_(unit) 331/ https://en.wikipedia.org/wiki/Furlong_(unit) 332/ 333/ Consequently we'll make two sets of definitions and prefix the 334/ variant US ones with "us". 335/ 336/ Since historically this file defined "surveyfoot" and "surveyyard" 337/ but "surveyorschain" and "surveyorslink", we will now end up with 338/ several sets for consistency. 339/ 340surveyfoot 1200|3937 meter 341surveyyard 3 surveyfoot 342 343rod 5.5 yard 344rd rod 345perch rod 346pole rod 347chain 66 foot 348link 1|100 chain 349furlong 220 yard 350 351usrod 5.5 surveyyard 352usperch usrod 353uspole usrod 354uschain 66 surveyfoot 355uslink 1|100 uschain 356usfurlong 220 surveyyard 357 358surveyorsfoot surveyfoot 359surveyorsyard surveyyard 360surveyorsrod usrod 361surveyorschain uschain 362surveyorslink uslink 363 364/ These are the same as the basic ones based on the international foot. 365/ https://en.wikipedia.org/wiki/Gunter's_chain 366/ https://en.wikipedia.org/wiki/Imperial_units 367guntersrod rod 368gunterschain chain 369gunterslink link 370 371/ typographical 372pica 1|6 in 373point 1|72 in 374 375/ data centers and machine rooms 376rackunit 1.75 in 377RU rackunit 378U rackunit 379 380/ physics 381bohrradius hbar2-C2/8.988e9 N m2-e2-electronmass 382 383/ miscellaneous/historical/obscure English units 384line 1|12 in 385barleycorn 1|3 in 386finger 7|8 in 387nail 1|16 yd 388palm 3 in 389hand 4 in 390quarter 9 in 391span 9 in 392cubit 18 in 393militarypace 2.5 feet 394pace 36 in 395ell 45 in 396smoot 67 in 397rope 20 ft 398bolt 40 yd 399skein 120 yd 400spindle 14400 yd 401 402/ more ells 403flemishell 27 inch 404scottishell 37.2 inch 405englishell 45 inch 406 407/ I can't find supporting evidence for this definition. 408rood 1.21e+3 yd 409 410/ other 411geodeticfoot surveyfoot 412geographicalmile 1852 m 413engineerschain 100 ft 414engineerslink 100|100 ft 415 416/ note that while caliber is technically a unit, caliber sizes for ammunition 417/ are usually short names for more complicated specifications. 418caliber 1e-2 in 419 420frenchfoot 16|15 ft 421frenchfeet frenchfoot 422toise 6 frenchfeet 423 424parasang 3.5 mi 425 426/ Thai length 427 428krabiat 0.5208 cm 429nio 4 krabiat 430khuep 12 nio 431sok 2 khuep 432wah 4 sok 433sen 20 wah 434yot 400 sen 435 436/ //////////////////////////////////////////////////////////// 437/ Speed 438 439admiraltyknot 6080 ft/hr 440knot nmile/hr 441mph mile/hr 442 443/ The speed of sound varies substantially with density, and thus 444/ both pressure and temperature. This number appears to be for 445/ 0 degrees Celsius at sea level. The value is considerably lower 446/ at typical flight altitudes for high-performance aircraft. 447mach 331.46 m/sec 448 449/ //////////////////////////////////////////////////////////// 450/ Area 451 452/ metric 453are 1e+2 m2 454hectare 1e+4 m2 455 456/ English 457sabin 1 ft2 458square 100 ft2 459acre 4840 yd2 460homestead 1|4 mi2 461quartersection 1|4 mi2 462section mi2 463township 36 mi2 464 465/ particle physics 466barn 1e-28 m2 467shed 1e-24 barn 468 469/ Thai area 470tarangwah wah2 471ngan 100 tarangwah 472rai 4 ngan 473 474/ //////////////////////////////////////////////////////////// 475/ Volume 476 477/ metric 478cc cm3 479liter kilocc 480litre liter 481ml milliliter 482stere m3 483 484/ US liquid volume 485 486gallon 231 in3 487gal gallon 488quart 1|4 gal 489qt quart 490pint 1|2 qt 491pt pint 492cup 1|2 pt 493gill 1|4 pt 494floz 1|16 pt 495tablespoon 1|2 floz 496teaspoon 1|3 tablespoon 497fldr 1|8 floz 498minim 1|60 fldr 499 500barrel 42 gal 501hogshead 63 gallon 502hd hogshead 503 504noggin 1|8 qt 505fifth 4|5 qt 506firkin 9 gal 507kilderkin 18 gal 508pipe 4 barrel 509tun 8 barrel 510 511/ US dry volume 512 513dry 268.8025 in3/gallon fuzz 514 515peck 8 dry-quart 516pk peck 517bushel 4 peck 518bu bushel 519strike 2 bu 520sack 3 bu 521coomb 4 bu 522seam 8 bu 523chaldron 36 bushel 524wey 40 bu 525last 80 bu 526 527cord 128 ft3 528cordfoot cord 529 530/ British volume 531 532imperial 1.20095 533 534brgallon 277.420 in3 fuzz 535brquart 1|4 brgallon 536brpint 1|2 brquart 537brfloz 1|20 brpint 538brpeck 554.84 in3 fuzz 539brbushel 4 brpeck 540cran 37.5 brgallon 541 542/ Bottles 543 544bottle 750 milliliter 545/bottle fifth 546 547miniature 100 milliliter 548split 1|4 bottle 549half 1|2 bottle 550magnum 2 bottle 551jeroboam 4 bottle 552rehoboam 6 bottle 553methuselah 8 bottle 554salmanazar 12 bottle 555balthazar 16 bottle 556nebuchadnezzar 20 bottle 557sovereign 34 bottle 558 559/ Bottles - alternate names and spellings 560 561pony split 562fillette half 563tappithen 3 bottle 564rheoboam rehoboam 565shalmaneser salmanazar 566 567/ //////////////////////////////////////////////////////////// 568/ Force 569 570/ SI unit 571newton kg-m/sec2 572nt newton 573N newton 574 575/ metric units 576dyne cm-gm/sec2 577sthene 1e+3 nt 578 579/ foot/pound units 580lbf lb g 581kip 1000 lbf 582poundal ft-lb/sec2 583pdl poundal 584 585/ //////////////////////////////////////////////////////////// 586/ Pressure 587 588/ SI unit 589pascal nt/m2 590 591/ metric units 592bar 1e+5 nt/m2 593barie 1e-1 nt/m2 594barye 1e-1 nt/m2 595pieze 1e+3 nt/m2 596 597/ other 598atmosphere 1.01325e+5 nt/m2 599atm atmosphere 600psi lb-g/in2 601torr mm hg 602 603/ //////////////////////////////////////////////////////////// 604/ Energy and work (and power) 605 606joule nt-m 607watt joule/sec 608W watt 609 610cal 4.1868 joule 611calorie cal 612kcal kilocal 613kcalorie kilocal 614frigorie kilocal 615 616britishthermalunit 1.05506e+3 joule fuzz 617btu britishthermalunit 618erg cm2-gm/sec2 619horsepower 550 ft-lb-g/sec 620hp horsepower 621therm 1e+5 btu 622thermie 1e+6 cal 623tnt 4.6e+6 m2/sec2 624 625/ //////////////////////////////////////////////////////////// 626/ Temperature 627 628degC K 629kelvin K 630degF 5|9 degC 631degreesrankine degF 632degrankine degreesrankine 633degreerankine degF 634degreaumur 10|8 degC 635 636/ //////////////////////////////////////////////////////////// 637/ Electrical 638 639/ SI units 640coulomb coul 641C coul 642ampere coul/sec 643amp ampere 644V volt 645volt watt/amp 646ohm volt/amp 647farad coul/volt 648henry sec2/farad 649weber volt-sec 650tesla weber/m2 651 652/ special-case abbreviations 653mh millihenry 654uf microfarad 655pf picofarad 656 657/ other 658biot 10 amp 659debye 3.336e-30 coul-m 660faraday 9.652e+4 coul 661gamma 1e-9 weber/m2 662gauss 1e-4 weber/m2 663gilbert 7.95775e-1 amp 664kilohm kiloohm 665maxwell 1e-8 weber 666megohm megaohm 667mho /ohm 668oersted 2.5e+2 pi-amp/m 669oe oersted 670siemens /ohm 671statcoul 1|2.99792458e9 coul 672statamp 1|2.99792458e9 amp 673statvolt 2.99792458e2 volt 674statcoulomb statcoul 675statampere statamp 676/ franklin is an alternate name for statcoulomb 677/ https://en.wikipedia.org/wiki/Franklin_(unit) 678franklin statcoul 679 680/ //////////////////////////////////////////////////////////// 681/ more energy 682 683eV e V 684ev e-volt 685electronvolt e-volt 686bev 1e+9 e-volt 687kev 1e+3 e-volt 688 689rydberg 1.36054e+1 ev 690 691/ //////////////////////////////////////////////////////////// 692/ Radiant intensity (and related phenomena) 693 694/ SI units 695cd candela 696lumen cd sr 697lux cd sr/m2 698 699/ Miscellaneous units 700apostilb cd/pi-m2 701blondel cd/pi-m2 702candle 1.02 candela 703equivalentfootcandle lumen/pi-ft2 704equivalentlux lumen/pi-m2 705equivalentphot cd/pi-cm2 706footcandle lumen/ft2 707footlambert cd/pi-ft2 708hefnercandle .92 cd 709lambert cd/pi-cm2 710nit cd/m2 711nox 1e-3 lux 712phot lumen/cm2 713skot 1e-3 apostilb 714stilb cd/cm2 715 716langley cal/cm2 717 718/ //////////////////////////////////////////////////////////// 719/ Radioactivity and radiation dosimetry 720 721/ Activity 722 723becquerel /sec 724Bq becquerel 725curie 3.7e+10 /sec 726Ci curie 727rutherford 1e+6 /sec 728 729/ Absorbed radiation dose 730 731gray joule/kg 732Gy gray 733rad 100 erg/gm 734 735/ Equivalent radiation dose 736 737sievert joule/kg 738Sv sievert 739rem 1e-2 sievert 740 741/ Legacy radiation dose 742 743roentgen 2.58e-4 coulomb/kg 744rontgen roentgen 745R roentgen 746 747/ //////////////////////////////////////////////////////////// 748/ Currency 749 750/ Wall Street Journal, July 2, 1993 751 752$ dollar 753argentinapeso $ 754australiadollar .66 $ 755bahraindinar 2.6522 $ 756brazilcruzeiro .000019 $ 757britainpound 1.49 $ 758canadadollar .77 $ 759czechkoruna .034 $ 760chilepeso .0025 $ 761chinarenminbi .174856 $ 762colombiapeso .001495 $ 763denmarkkrone .15 $ 764ecuadorsucre .000539 $ 765europeeuro 0.9142 $ 766greatbritainpound britainpound 767hongkongdollar .13 $ 768hungaryforint .011 $ 769indiarupee .03211 $ 770indonesiarupiah .0004782 $ 771israelshekel .3642 $ 772japanyen .0093 $ 773jordandinar 1.4682 $ 774kuwaitdinar 3.3173 $ 775lebanonpound .000578 $ 776malaysiaringgit .338 $ 777maltalira 2.6042 $ 778mexicopeso .3205128 $ 779newzealanddollar .539 $ 780norwaykrone .139 $ 781pakistanrupee .037 $ 782perunewsol .5065 $ 783philippinespeso .03738 $ 784polandzloty .000059 $ 785saudiarabiariyal .26702 $ 786singaporedollar .6157 $ 787slovakkoruna .034 $ 788southafricarand .21 $ 789southkoreawon .001 $ 790swedenkrona .13 $ 791switzerlandfranc .66 $ 792taiwandollar .038285 $ 793thailandbaht .03962 $ 794turkeylira .0000929 $ 795unitedarabdirham .2723 $ 796uruguaynewpeso .246852 $ 797venezuelabolivar .011 $ 798 799/ The following currencies are locked to the Euro: 800/ <URL:http://www.ecb.int/change/conversion.htm> 801belgiumfranc 1|40.3399 euro 802germanymark 1|1.95583 euro 803spainpeseta 1|166.386 euro 804francefranc 1|6.55957 euro 805irelandpunt 1|.787564 euro 806italylira 1|1936.27 euro 807luxembourgfranc 1|40.3399 euro 808netherlandsguilder 1|2.20371 euro 809austriaschilling 1|13.7603 euro 810portugalescudo 1|200.482 euro 811finlandmarkka 1|5.94573 euro 812greecedrachma 1|340.750 euro 813 814mark germanymark 815euro europeeuro 816bolivar venezuelabolivar 817peseta spainpeseta 818rand southafricarand 819escudo portugalescudo 820newsol perunewsol 821guilder netherlandsguilder 822hollandguilder netherlandsguilder 823peso mexicopeso 824yen japanyen 825lira italylira 826rupee indiarupee 827drachma greecedrachma 828franc francefranc 829markka finlandmarkka 830sucre ecuadorsucre 831poundsterling britainpound 832cruzeiro brazilcruzeiro 833 834buck dollar 835cent centidollar 836fin 5 dollar 837 838/ //////////////////////////////////////////////////////////// 839/ size of data 840 841baud bit/sec 842byte 8 bit 843block 512 byte 844kbyte 1024 byte 845megabyte 1024 kbyte 846gigabyte 1024 megabyte 847meg megabyte 848gig gigabyte 849terabyte 1024 gigabyte 850petabyte 1024 terabyte 851 852 853/ //////////////////////////////////////////////////////////// 854/ Trivia and miscellaneous units 855 856arpentcan 27.52 mi 857arpentlin 191.835 ft 858boardfoot 144 in3 859bottommeasure 1|40 in 860refrigeration 12000 btu/ton-hour 861caratgold 1|24 862ccs 1|36 erlang 863cfs ft3/sec 864circularinch 1|4 pi-in2 865circularmil 1e-6|4 pi-in2 866clusec 1e-8 mm-hg m3/s 867crith 9.06e-2 gm 868diopter /m 869displacementton 35 ft3 870doppelzentner 100 kg 871drop .03 cm3 872galileo 1e-2 m/sec2 873imaginarycubicfoot 1.4 ft3 874karat 1|24 875key kg 876lusec 1e-6 mm-hg m3/s 877mgd megagal/day 878minersinch 1.5 ft3/min 879mpg mile/gal 880poise gm/cm-sec 881registerton 100 ft3 882rhe 10 m2/nt-sec 883shippington 40 ft3 884stoke 1e-4 m2/sec 885timberfoot ft3 886water gram g / cc 887Xunit 1.00202e-13 m 888 889brewster 1e-12 m2/newton 890poncelet 100 kg m g / sec 891denier .05|450 gram / m 892tex .001 gram / m 893iudiptheria 62.8 microgram 894iupenicillin .6 microgram 895iuinsulin 41.67 microgram 896cottonyarncount 2520 ft/pound 897linenyarncount 900 ft/pound 898worstedyarncount 1680 ft/pound 899metricyarncount meter/gram 900jewelerspoint 2 milligram 901 902