units(1) units(1)
NAME
units - conversion program
SYNOPSIS
units
DESCRIPTION
units computes conversion factors for units given in different scales.
FUNCTIONALITY
units outputs the conversion factors required for two units at a time.
It works interactively, i.e. prompts you to enter the first unit as
soon as you issue the command:
$ units
you have:
On entering the first unit, you will be prompted again for the second
unit:
you want:
After you specify the second unit, units will print the required
conversion factors. The first factor indicates the number with which
the first unit must be multiplied in order to obtain the second unit;
this factor is preceded by an asterisk (*).
The second conversion factor indicates the number with which the
second unit must be multiplied in order to obtain the first unit. A
slash (/) precedes this factor. Both conversion factors are printed in
scientific notation with six decimal places. For example: 9.797299e-01
represents 9.797299 * 10^-1, i.e. 0.9797299.
Example:
$ units
you have: inch
you want: cm
* 2.540000e+00
/ 3.937008e-01
The units to be converted can be defined by arbitrarily combining
other units as follows:
- Units separated by one or more blanks are multiplied.
- Units separated by a slash / are divided.
- Powers are indicated by suffixed positive integers.
- Preceding positive integers are interpreted as numeric multipliers.
Page 1 Reliant UNIX 5.44 Printed 11/98
units(1) units(1)
Example
$ you have: 15 lbs force/in2
you want: atm
* 1.020689e+00
/ 9.797299e-01
units can only compute conversions that can be expressed in terms of a
product; thus, it cannot compute a conversion factor from Celsius to
Fahrenheit, for example.
As well as common units and their abbreviations, units recognizes a
number of constants from the fields of chemistry, physics and
mathematics:
pi ratio of circumference to diameter
c speed of light
e charge of an electron
g acceleration of gravity
force same as g
mole Avogadro's number.
The file /usr/share/lib/unittab includes a comprehensive table of all
units and constants known to units as well as the conversion factors
used (but note that the foreign currency exchange rates are out of
date).
For the system administrator only
The system administrator may edit the file
/usr/share/lib/unittab in order, for example, to update the
conversion factors for the various currencies or to add new
units and their conversion factors.
Striking the <DEL> or <CTRL-D> key terminates the execution of units.
ERROR MESSAGES
cannot recognize xyz
You have specified a unit that is unknown to the units command. Check
the valid units in the /usr/share/lib/unittab file.
conformability
units cannot calculate a conversion factor for the given units. The
definitions of the specified units are also output with this error
message.
Page 2 Reliant UNIX 5.44 Printed 11/98
units(1) units(1)
EXAMPLES
Example 1
Convert miles to kilometers:
$ units
you have: mile
you want: km
* 1.609344e+00
/ 6.213712e-01
<CTRL-D>
$
Example 2
Convert bars to atmospheres:
$ units
you have: bar
you want: atm
* 9.869233e-01
/ 1.013250e+00
<CTRL-D>
$
Example 3
Convert gallons to barrels:
$ units
you have: gallon
you want: barrel
* 2.380952e-02
/ 4.200000e+01
<CTRL-D>
$
FILES
/usr/share/lib/unittab
Contains a complete list of all units and constants recognized by
the units command.
Page 3 Reliant UNIX 5.44 Printed 11/98