units(1) Commands units(1) NAME units - convert units of measurement SYNOPSIS units [ -WC ] [ -v ] [ -f definition-file ]... OPTIONS -W prints the warranty information. -C prints the copying conditions and license. -f definition-file tells units to read unit definitions from the spec- ified file instead of from the usual definition file, /usr/lib/unittab. Any number of definition files may be used; definitions in later files that conflict with earlier definitions are ignored. -v puts units into 'verbose' mode; it will report on which databases it is trying to read and whether it was able to read them successfully DESCRIPTION The units program computes the conversion factors between any two units of measurement. For example, if you don't remember how to convert feet to meters, enter: You Have: feet You Want: meters units will print * 0.3048 / 3.28084 indicating that you should multply by 0.3048, or divide by 3.28084, to convert from feet to meters. If you want to know how many meters are in eleven feet, use: You Have: 11 feet You Want: meters The result is: * 3.3528 / 0.298258 There are 3.3528 meters in 11 feet. units understands complicated compound units formed by multiplying or dividing other units. For example, if (for some (inexplicable) reason) you wanted to convert kilo- calories per Ohm-statcoulomb to Tera-abamperes, you could do that. As a more useful example, how fast is 55 miles per hour in feet per second? Plover Systems 2 December 1996 1 units(1) Commands units(1) You Have: 55 mi/hr You Want: ft/sec * 80.6667 / 0.0123967 It's 80.6667 feet per second. What is the speed of light in furlongs per fortnight? You Have: c You Want: furlongs / fortnight * 1.80262e+12 / 5.54749e-13 The speed of light is 1.8 trillion furlongs per fortnight. What is the acceleration due to gravity, in miles per hour per second? You Have: gee You Want: miles per hour per second * 21.922 / 0.0456163 Every second an object falls, its speed increases by about 22 mph. You can abbreviate miles per hour per second to any of miles/hour/second mi/hr/sec mi/hr/s mi/(3600 s2) units understands the usual metric prefixes (deci-, centi-, kilo-, etc.) and most common (and many uncommon) units of measurement and abbreviations (`amp' for `ampere', `N' for `newton', `ft' for `feet', etc.) An integer suffixed to a unit of measurement denotes the unit raised to a power, so, for example, `cm2' denotes square centimeters. White space or a hyphen between two units multplies the units, so that `Newton-meters' denotes New- ton-meters. The word `per' or a slash between two units denotes division, so that `Joules/second' and `Joules per second' denote Joules per second. If units does not rec- ognize a unit name, and the name ends in the letter `s', units discards the `s' and tries again, so that `meters' is the same as `meter' unless there is a separate defin- tion of `meters'. Parentheses may be used to group units. Any unit may be prefixed with a floating point constant to multiply it by that constant, so that `10m' denotes ten meters. The notation `3|4' denotes the fraction three- Plover Systems 2 December 1996 2 units(1) Commands units(1) fourths. If the two units you enter don't have the same dimension (``How many acres are in a second?''), units prints the message conformability (Not the same dimension) and then prints the internal forms of both units of mea- surment, to show what it thinks they are defined as. For example, let's ask what the acceleration due to gravity is, in Watts; this doesn't make sense, because the Watt is a unit of power, not acceleration: You have: gee You want: W conformability (Not the same dimension) 9.8 meter per second^2 1000 gram meter^2 per second^3 This says that the conversion couldn't be done, because `gee' is 9.8 meters per second per second, and `W' is a kilogram meter squared per second cubed; not the same thing at all. If your input has the form # name definition Where `name' is any sequence of letters, and `definition' is any unit, units will define a new unit with the given name and definition. As a special case, if the definition is `***', units will define a new fundamental unit that is orthogonal to all existing units. BUGS, CAVEATS, AND WARNINGS Hyphens after SI prefixes do not work. For example, `mega-electron-volt' and `mega-eV' are misparsed, and you must use `megaelectron-volt' and `megaeV' instead. Negative integers are not recognized as exponents. For example, `cm-1' is not analogous to `cm2'. You must write `1/cm' instead. `pound' is a unit of mass rather than force. (It is syn- onymous with `slug'.) Although this is contrary to the usual definition, it permits intuitive conversions from pounds to kilograms, at the expense of complicating cer- tain other conversions; for example, `foot-pound' does not work. Use `lbf' or `gee-pound' if you want a pound of force. Use `footpound' or `ft-lbf' for foot-pounds. Similarly, `ounce' and `oz' denote ounces of mass; use `gee-oz' for an ounce of force, and `floz' for a fluid ounce of volume. `Pint', `quart', etc., are the American versions. For British units, use `britpint' etc. Plover Systems 2 December 1996 3 units(1) Commands units(1) `ton', `hundredweight', etc. are the `long' versions; for the `short' versions use the prefix `short', as with `short ton', `short hundredweight', etc. Troy weights all begin with `troy', as `troyoz', etc. `year' means the tropical year. For sidereal year or cal- endar (civil) year, use `siderealyear' or `calendaryear' respectively. `day' means `mean solar day'. For sidereal days, use `siderealday' units can only convert multiplicative units. This means, in particular, that it is not capable of converting degrees Cesius or degrees Fahrenheit to anything else, including to Kelvins or to each other. There is no good solution to this problem, because `degrees Celsius' has two different meanings, distinguished only by context: If you want to say that the temperature now is nine degrees Fahrenheit higher than this morning, how do you convert that nine degrees to Kelvins? It's five Kelvins higher also; the conversion is 9:5. But if you say that the tem- perature now is 63 degrees Fahrenheit, and ask how many Kelvins is that, the answer is not 35; it's 290. We could add `Fahrenheit' to the database and define it as `5|9 Kelvin', and it would work fine for converting temperature intervals but you know some poor slob would ask it for the melting point of ice in absolute Kelvins and get 17.8 above absolute zero. So it's really safer to leave it out. units can, however, convert Kelvins to degrees Rankine. Rankine (`Ra') are the same as Fahrenheit for temperature intervals, and Kelvins are the same as Celsius for inter- vals, so if you're converting intervals, you have my per- mission to use Kelvins and degrees Rankine. Prefixes like `kilo-' and `mega-' always refer to 1,000 and 1,000,000, respectively. This is in accordance with international standards. However, it implies that units like `kilobit' and `megabyte' may not mean what you want them to. units provides `kbyte', `kb', `mbyte', and `meg' for 1024-based multiples of `byte', and `kbit', `Kbit', `mbit', and `Mbit' for 1024-based mutliples of `bit'. The standard prefixes `kibi-', `mebi-', etc., are not presently supported. Note that units also assumes that there are 8 bits in a byte. Some measurements may be inexact. For example, `gee', the acceleration due to gravity, varies from place to place on the earth; units uses a typical mean value. The author does not vouch for the accuracy or usability of any of the conversions performed by this program. This is especially true of the currency conversions. Plover Systems 2 December 1996 4 units(1) Commands units(1) Speaking of currency conversions, units' notion of British currency structure is about fifty years out of date. It thinks there are twelve pence in a shilling, and twnety shillings in a pound. This is supposed to be more useful than the modern decimal defintion, because you might want to know how many pence in a half-crown. The unit of British currency is called the `pound.sterling' or just `sterling' to distinguish it from the `pound'. Note that `thruppence hapenny' is the product of `thruppence' and `hapenny', not the sum. Units are case-sensitive. This is because it is important to distinguish `C' (Coulombs) from `c' (velocity of light). In most cases, units named after people (`volt', `watt') have both upper can lowercase versions. You should see the /usr/lib/unittab file for many other interesting details and definitions. Files /usr/lib/unittab Master units database Author Mark-Jason Dominus, Plover Systems (mjd-perl- units@plover.com.com) COPYING Copyright (c) 1996,1999 M-J. Dominus (mjd-perl- units@plover.com) The /usr/lib/unittab file is in the public domain. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified ver- sions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above con- ditions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English. Plover Systems 2 December 1996 5