1 .\" $FreeBSD: src/usr.bin/units/units.1,v 1.18 2005/02/13 22:25:25 ru Exp $
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 Print the version number.
23 .It Ar from-unit to-unit
24 Allow a single unit conversion to be done directly from the command
26 The program will not print prompts.
28 result of the single specified conversion.
33 program converts quantities expressed in various scales to
34 their equivalents in other scales.
38 handle multiplicative scale changes.
39 Experimental support is available to convert Celsius to Fahrenheit.
40 It works interactively by prompting
54 You want: furlongs/fortnight
68 Powers of units can be specified using the '^' character as shown in
69 the example, or by simple concatenation: 'cm3' is equivalent to 'cm^3'.
70 Multiplication of units can be specified by using spaces, a dash or
72 Division of units is indicated by the slash ('/').
73 Note that multiplication has a higher precedence than division,
74 so 'm/s/s' is the same as 'm/s^2' or 'm/s s'.
76 must be indicated using the vertical bar ('|').
78 meter, you would write '1|2 meter'.
79 If you write '1/2 meter' then the
80 units program would interpret that as equivalent to '0.5/meter'.
81 If you enter incompatible unit types, the units program will
82 print a message indicating that the units are not conformable and
83 it will display the reduced form for each unit:
86 You want: fathoms kg^2 / day
88 2.7777778e-11 kg m^2 / sec^3
89 2.1166667e-05 kg^2 m / sec
92 The conversion information is read from a units data file.
94 file includes definitions for most familiar units, abbreviations and
96 Some constants of nature included are:
98 .Bl -column -offset indent -compact "mercury"
99 .It "pi ratio of circumference to diameter"
100 .It "c speed of light"
101 .It "e charge on an electron"
102 .It "g acceleration of gravity"
103 .It "force same as g"
104 .It "mole Avogadro's number"
105 .It "water pressure per unit height of water"
106 .It "mercury pressure per unit height of mercury"
107 .It "au astronomical unit"
110 The unit 'pound' is a unit of mass.
111 Compound names are run together
112 so 'pound force' is a unit of force.
113 The unit 'ounce' is also a unit
115 The fluid ounce is 'floz'.
116 British units that differ from
117 their US counterparts are prefixed with 'br', and currency is prefixed
118 with its country name: 'belgiumfranc', 'britainpound'.
120 for a unit, if the specified string does not appear exactly as a unit
123 will try to remove a trailing 's' or a
124 trailing 'es' and check again for a match.
126 To find out what units are available read the standard units file.
127 If you want to add your own units you can supply your own file.
128 A unit is specified on a single line by
129 giving its name and an equivalence.
131 new units in terms of old ones so that a reduction leads to the
132 primitive units which are marked with '!' characters.
135 program will not detect infinite loops that could be caused
136 by careless unit definitions.
137 Comments in the unit definition file
138 begin with a '/' character at the beginning of a line.
140 Prefixes are defined in the same was as standard units, but with
141 a trailing dash at the end of the prefix name.
142 If a unit is not found
143 even after removing trailing 's' or 'es', then it will be checked
144 against the list of prefixes.
145 Prefixes will be removed until a legal
146 base unit is identified.
148 Here is an example of a short units file that defines some basic
151 .Bl -column -offset indent -compact "minute"
162 .Bl -tag -width /usr/share/misc/units.lib -compact
163 .It Pa /usr/share/misc/units.lib
164 the standard units library
167 .An Adrian Mariano Aq adrian@cam.cornell.edu
169 The effect of including a '/' in a prefix is surprising.
171 Exponents entered by the user can be only one digit.
172 You can work around this by multiplying several terms.
174 The user must use | to indicate division of numbers and / to
175 indicate division of symbols.
176 This distinction should not
179 The program contains various arbitrary limits on the length
180 of the units converted and on the length of the data file.
182 The program should use a hash table to store units so that
183 it does not take so long to load the units list and check