.TH units "" "" Command
.PC "Convert measurements"
\fBunits [ \-u ]\fR
.PP
.HS
.SH Option:
.IC "\fB\-u\fR"
Update binary file only
.Pp
\fBunits\fR works interactively.
.HE
.B units
is an interactive program that tells you how to convert one unit
of measurement into another.
It prompts you for
two quantities with the same dimension (e.g., two measurements of
weight, or two of size).
It first prints the prompt ``You have:'' to ask for the unit you wish to
convert from, and then prints
the prompt ``You want:'' for the unit you wish to convert to.
.SH Example
The following example returns the formula for convert fortnights
into days:
.DM
	You have: fortnight
	You want: days
	* 14
	/ 0.071428
.DE
.PP
The following fundamental units are recognized:
.BR meter ,
.BR gram ,
.BR second ,
.BR coulomb ,
.BR radian ,
.BR bit ,
.BR unitedstatesdollar ,
.BR sheet ,
.BR candle ,
.BR kelvin ,
and
.B copperpiece
(shillings and pence).
.PP
A quantity consists of
an optional number (default, 1) and a dimension
(default, none).
Numbers are floating point with optional sign, decimal part
and exponent.
Dimensions may be specified by fundamental or derived units,
with optional orders.
A quantity is evaluated left to right:
a factor preceded by a `/' is a divisor, otherwise it is a multiplier.
For example, the earth's gravitational acceleration may be entered as
any of the following:
.DM
	9.8e+0 m+1 sec\-2
	32 ft/sec/sec
	32 ft/sec+2
.DE
.PP
British equivalents of US units are prefixed with
.B br,
e.g.,
.BR brpint .
Other units include
.B c
(speed of light),
.B G
(gravitational constant),
.B R
(gas-law constant),
.B phi
(golden ratio) % (1/100),
.B k
(1,024),
and
.B buck
(United States dollar).
.PP
.B /usr/lib/units
is the ASCII file that contains conversion tables.
The binary file
.B /usr/lib/binunits
may be recreated by using the
.B \-u
option.
.SH Files
\fB/usr/lib/units\fR \(em Known units
.br
\fB/usr/lib/binunits\fR \(em Binary encoding of units file
.SH "See Also"
.Xr "bc,"  bc
.Xr "commands," commands
.Xr "conv" conv
.SH Diagnostics
If the ASCII file
.B /usr/lib/units
has changed more recently than the binary file
.BR /usr/lib/binunits ,
.B units
prints a message and regenerates the binary file before it continues;
this can take up to a few minutes, depending upon the speed of your system.
.PP
The error message
``conformability'' means that the quantities are not dimensionally compatible,
e.g.,
.B m/sec
and
.BR psi .
.B units
prints each quantity and its dimensions in fundamental units.
.SH Notes
There are the inevitable name collisions:
.B g
for gram versus
.B gee
for Earth's gravitational acceleration,
.B exp
for the base of natural logarithms versus
.B e
for the charge of an electron,
.B ms
for (plural) meters versus
.B millisecond,
and, of course,
.B batman
for the Persian measure of weight rather than the Turkish.
