units
PURPOSE
Converts units in one measure to equivalent units in
another measure.
SYNOPSIS
units
DESCRIPTION
The units command converts quantities expressed in one
measurement to their equivalents in another. units is an
interactive command. It prompts you for the unit you
want to convert from and the unit you want to convert to
(see "Examples"). This command only does multiplicative
scale changes. That is, it can convert from one value to
another only when the conversion is done with a multipli-
cation factor. For example, it can not convert between
degrees Fahrenheit and degrees Celsius, because 32 must
be added or subtracted in the conversion.
You can specify a quantity as a multiplicative combina-
tion of units, optionally preceded by a numeric multi-
plier.
Indicate powers by suffixed positive integers and divi-
sion by / (slash).
The units command recognizes lb as a unit of mass, but
considers pound to be the British pound sterling. Com-
pound names are run together (such as lightyear). Prefix
British units differing from their American counterparts
with br (brgallon for instance). The file
/usr/lib/unittab contains a complete list of the units
that the units command uses.
Most familiar units, abbreviations, and metric prefixes
are recognized, together with the following:
pi Ratio of circumference to diameter
c Speed of light
e Charge on an electron
g Acceleration of gravity
force Same as g
mole Avogadro's number
water Pressure head per unit height of water
au Astronomical unit.
EXAMPLES
To start the units command, enter:
units
Now you can try the following examples. In these exam-
ples, the text that you enter is shown in "bold type" and
the output from units is shown in "non-bold type".
1. To display conversion factors:
you have: in
you want: cm
* 2.540000e+00
/ 3.937008e-01
The output from units tells you to multiply the
number of inches by "2.540000e+00" to get centime-
ters, and to multiply the number of centimeters by
"3.937008e-01" to get inches.
These numbers are in standard exponential notation,
so "3.937008e-01" means "3.937008" S "10(-1)", which
is the same as "0.3937008". The second number is
always the reciprocal of the first. That is, "2.54 =
1" : "0.3937008".
2. To convert a measurement to different units:
you have: 5 years
you want: microsec
* 1.577846e+14
/ 6.337753e-15
The output shows that "5 years" equals
"1.577846S10(14)" microseconds, and that one micro-
second equals "6.337753S10(-15)" years.
3. To give fractions in measurements:
you have: 1|3 mi
you want: km
* 5.364480e-01
/ 1.864114e+00
The | (vertical bar) indicates division, so "1|3"
means one-third. This shows that one-third mile is
the same as "0.536448" kilometers.
4. To include exponents in measurements:
you have: 1.2-5 gal
you want: floz
* 1.536000e-03
/ 6.510417e+02
The expression "1.2-5 gal" stands for "1.2S10(-5)".
Do not type an e before the exponent. This example
shows that "1.2S10(-5)" ("0.000012") gallons equal
"1.536S10(-3)" ("0.001536") fluid ounces.
5. To specify complex units:
you have: gram centimeter/second2
you want: kg-m/sec2
* 1.000000e-05
/ 1.000000e+05
The units gram centimeter/second2 mean "grams S cen-
timeters : second(2)." similarly, kg-m/sec2 means
"kilograms S meters : sec(2)," which is often read as
"kilogram-meters per seconds squared." Note that you
can show multiplication of units with a - (hyphen) or
with a blank.
6. If the units you specify after ""you have"" and ""you
want"" are incompatible:
you have: ft
you want: lb
conformability
3.048000e-01 m
4.535924e-01 kg
The message "conformability" means that the units you
specified cannot be converted. Feet measure length,
and pounds measure mass, so converting from one to
the other doesn't make sense. Therefore, the units
command displays the equivalent of each value in
standard units.
In other words, this example shows that one foot
equals "0.3048" meters and that one pound equals
"0.4535924" kilograms. units shows the equivalents
in meters and kilograms because the command considers
these units to be "standard" measures of length and
mass.
FILES
/usr/lib/unittab