1 .\" $FreeBSD: head/usr.bin/units/units.1 264470 2014-04-14 20:51:04Z eadler $
12 .Op Ar from-unit to-unit
14 The following options are available:
15 .Bl -tag -width indent
17 Specify the name of the units data file to load.
19 Suppress prompting of the user for units and the display of statistics
20 about the number of units loaded.
22 If the default unit file exists prints its location.
25 Units data file not found
28 Print the version number, usage, and then exit.
29 .It Ar from-unit to-unit
30 Allow a single unit conversion to be done directly from the command
32 The program will not print prompts.
34 result of the single specified conversion.
36 Print the units in the conversion output.
37 Be more verbose in general.
42 program converts quantities expressed in various scales to
43 their equivalents in other scales.
47 handle multiplicative or affine scale changes.
48 It works interactively by prompting
62 You want: furlongs/fortnight
76 Powers of units can be specified using the '^' character as shown in
77 the example, or by simple concatenation: 'cm3' is equivalent to 'cm^3'.
78 Multiplication of units can be specified by using spaces, a dash or
80 Division of units is indicated by the slash ('/').
81 Note that multiplication has a higher precedence than division,
82 so 'm/s/s' is the same as 'm/s^2' or 'm/s s'.
84 must be indicated using the vertical bar ('|').
86 meter, you would write '1|2 meter'.
87 If you write '1/2 meter' then the
88 units program would interpret that as equivalent to '0.5/meter'.
89 If you enter incompatible unit types, the units program will
90 print a message indicating that the units are not conformable and
91 it will display the reduced form for each unit:
94 You want: fathoms kg^2 / day
96 2.7777778e-11 kg m^2 / sec^3
97 2.1166667e-05 kg^2 m / sec
100 The conversion information is read from a units data file.
102 file includes definitions for most familiar units, abbreviations and
104 Some constants of nature included are:
106 .Bl -column -offset indent -compact "mercury"
107 .It "pi ratio of circumference to diameter"
108 .It "c speed of light"
109 .It "e charge on an electron"
110 .It "g acceleration of gravity"
111 .It "force same as g"
112 .It "mole Avogadro's number"
113 .It "water pressure per unit height of water"
114 .It "mercury pressure per unit height of mercury"
115 .It "au astronomical unit"
118 The unit 'pound' is a unit of mass.
119 Compound names are run together
120 so 'pound force' is a unit of force.
121 The unit 'ounce' is also a unit
123 The fluid ounce is 'floz'.
124 British units that differ from
125 their US counterparts are prefixed with 'br', and currency is prefixed
126 with its country name: 'belgiumfranc', 'britainpound'.
128 for a unit, if the specified string does not appear exactly as a unit
131 will try to remove a trailing 's' or a
132 trailing 'es' and check again for a match.
134 To find out what units are available read the standard units file.
135 If you want to add your own units you can supply your own file.
136 A unit is specified on a single line by
137 giving its name and an equivalence.
139 new units in terms of old ones so that a reduction leads to the
140 primitive units which are marked with '!' characters.
143 program will not detect infinite loops that could be caused
144 by careless unit definitions.
145 Comments in the unit definition file
146 begin with a '/' character at the beginning of a line.
148 Prefixes are defined in the same was as standard units, but with
149 a trailing dash at the end of the prefix name.
150 If a unit is not found
151 even after removing trailing 's' or 'es', then it will be checked
152 against the list of prefixes.
153 Prefixes will be removed until a legal
154 base unit is identified.
156 Here is an example of a short units file that defines some basic
159 .Bl -column -offset indent -compact "minute"
170 .Bl -tag -width /usr/share/misc/units.lib -compact
171 .It Pa /usr/share/misc/units.lib
172 the standard units library
175 .An Adrian Mariano Aq Mt adrian@cam.cornell.edu
177 The effect of including a '/' in a prefix is surprising.
179 Exponents entered by the user can be only one digit.
180 You can work around this by multiplying several terms.
182 The user must use | to indicate division of numbers and / to
183 indicate division of symbols.
184 This distinction should not
187 The program contains various arbitrary limits on the length
188 of the units converted and on the length of the data file.
190 The program should use a hash table to store units so that
191 it does not take so long to load the units list and check