1 .\" $FreeBSD: src/usr.bin/units/units.1,v 1.8.2.5 2001/07/22 12:40:40 dd Exp $
2 .\" $DragonFly: src/usr.bin/units/units.1,v 1.3 2006/02/17 19:39:13 swildner Exp $
13 .Op Ar from-unit to-unit
15 The following options are available:
16 .Bl -tag -width indent
18 Specify the name of the units data file to load.
20 Suppress prompting of the user for units and the display of statistics
21 about the number of units loaded.
23 Print the version number.
24 .It Ar from-unit to-unit
25 Allow a single unit conversion to be done directly from the command
26 line. The program will not print prompts. It will print out the
27 result of the single specified conversion.
32 program converts quantities expressed in various scales to
33 their equivalents in other scales. The
36 handle multiplicative scale changes. It cannot convert Celsius
37 to Fahrenheit, for example. It works interactively by prompting
51 You want: furlongs/fortnight
61 Powers of units can be specified using the '^' character as shown in
62 the example, or by simple concatenation: 'cm3' is equivalent to 'cm^3'.
63 Multiplication of units can be specified by using spaces, a dash or
64 an asterisk. Division of units is indicated by the slash ('/').
65 Note that multiplication has a higher precedence than division,
66 so 'm/s/s' is the same as 'm/s^2' or 'm/s s'. Division of numbers
67 must be indicated using the vertical bar ('|'). To convert half a
68 meter, you would write '1|2 meter'. If you write '1/2 meter' then the
69 units program would interpret that as equivalent to '0.5/meter'.
70 If you enter incompatible unit types, the units program will
71 print a message indicating that the units are not conformable and
72 it will display the reduced form for each unit:
75 You want: fathoms kg^2 / day
77 2.7777778e-11 kg m^2 / sec^3
78 2.1166667e-05 kg^2 m / sec
81 The conversion information is read from a units data file. The default
82 file includes definitions for most familiar units, abbreviations and
83 metric prefixes. Some constants of nature included are:
85 .Bl -inset -offset indent -compact
86 .It "pi ratio of circumference to diameter
88 .It "e charge on an electron
89 .It "g acceleration of gravity
91 .It "mole Avogadro's number
92 .It "water pressure per unit height of water
93 .It "mercury pressure per unit height of mercury
94 .It "au astronomical unit
97 The unit 'pound' is a unit of mass. Compound names are run together
98 so 'pound force' is a unit of force. The unit 'ounce' is also a unit
99 of mass. The fluid ounce is 'floz'. British units that differ from
100 their US counterparts are prefixed with 'br', and currency is prefixed
101 with its country name: 'belgiumfranc', 'britainpound'. When searching
102 for a unit, if the specified string does not appear exactly as a unit
105 will try to remove a trailing 's' or a
106 trailing 'es' and check again for a match.
108 To find out what units are available read the standard units file.
109 If you want to add your own units you can supply your own file.
110 A unit is specified on a single line by
111 giving its name and an equivalence. Be careful to define
112 new units in terms of old ones so that a reduction leads to the
113 primitive units which are marked with '!' characters.
116 program will not detect infinite loops that could be caused
117 by careless unit definitions. Comments in the unit definition file
118 begin with a '/' character at the beginning of a line.
120 Prefixes are defined in the same was as standard units, but with
121 a trailing dash at the end of the prefix name. If a unit is not found
122 even after removing trailing 's' or 'es', then it will be checked
123 against the list of prefixes. Prefixes will be removed until a legal
124 base unit is identified.
126 Here is an example of a short units file that defines some basic
129 .Bl -inset -offset indent -compact
140 .Bl -tag -width /usr/share/misc/units.lib -compact
141 .It Pa /usr/share/misc/units.lib
142 the standard units library
145 .An Adrian Mariano Aq adrian@cam.cornell.edu
147 The effect of including a '/' in a prefix is surprising.
149 Exponents entered by the user can be only one digit.
150 You can work around this by multiplying several terms.
152 The user must use | to indicate division of numbers and / to
153 indicate division of symbols. This distinction should not
156 The program contains various arbitrary limits on the length
157 of the units converted and on the length of the data file.
159 The program should use a hash table to store units so that
160 it doesn't take so long to load the units list and check