1 .\" $FreeBSD: src/usr.bin/units/units.1,v 1.18.22.1.2.1 2009/10/25 01:10:29 kensmith 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 It cannot convert Celsius
40 to Fahrenheit, for example.
41 It works interactively by prompting
55 You want: furlongs/fortnight
65 Powers of units can be specified using the '^' character as shown in
66 the example, or by simple concatenation: 'cm3' is equivalent to 'cm^3'.
67 Multiplication of units can be specified by using spaces, a dash or
69 Division of units is indicated by the slash ('/').
70 Note that multiplication has a higher precedence than division,
71 so 'm/s/s' is the same as 'm/s^2' or 'm/s s'.
73 must be indicated using the vertical bar ('|').
75 meter, you would write '1|2 meter'.
76 If you write '1/2 meter' then the
77 units program would interpret that as equivalent to '0.5/meter'.
78 If you enter incompatible unit types, the units program will
79 print a message indicating that the units are not conformable and
80 it will display the reduced form for each unit:
83 You want: fathoms kg^2 / day
85 2.7777778e-11 kg m^2 / sec^3
86 2.1166667e-05 kg^2 m / sec
89 The conversion information is read from a units data file.
91 file includes definitions for most familiar units, abbreviations and
93 Some constants of nature included are:
95 .Bl -column -offset indent -compact "mercury"
96 .It "pi ratio of circumference to diameter
98 .It "e charge on an electron
99 .It "g acceleration of gravity
101 .It "mole Avogadro's number
102 .It "water pressure per unit height of water
103 .It "mercury pressure per unit height of mercury
104 .It "au astronomical unit
107 The unit 'pound' is a unit of mass.
108 Compound names are run together
109 so 'pound force' is a unit of force.
110 The unit 'ounce' is also a unit
112 The fluid ounce is 'floz'.
113 British units that differ from
114 their US counterparts are prefixed with 'br', and currency is prefixed
115 with its country name: 'belgiumfranc', 'britainpound'.
117 for a unit, if the specified string does not appear exactly as a unit
120 will try to remove a trailing 's' or a
121 trailing 'es' and check again for a match.
123 To find out what units are available read the standard units file.
124 If you want to add your own units you can supply your own file.
125 A unit is specified on a single line by
126 giving its name and an equivalence.
128 new units in terms of old ones so that a reduction leads to the
129 primitive units which are marked with '!' characters.
132 program will not detect infinite loops that could be caused
133 by careless unit definitions.
134 Comments in the unit definition file
135 begin with a '/' character at the beginning of a line.
137 Prefixes are defined in the same was as standard units, but with
138 a trailing dash at the end of the prefix name.
139 If a unit is not found
140 even after removing trailing 's' or 'es', then it will be checked
141 against the list of prefixes.
142 Prefixes will be removed until a legal
143 base unit is identified.
145 Here is an example of a short units file that defines some basic
148 .Bl -column -offset indent -compact "minute"
159 .Bl -tag -width /usr/share/misc/units.lib -compact
160 .It Pa /usr/share/misc/units.lib
161 the standard units library
164 .An Adrian Mariano Aq adrian@cam.cornell.edu
166 The effect of including a '/' in a prefix is surprising.
168 Exponents entered by the user can be only one digit.
169 You can work around this by multiplying several terms.
171 The user must use | to indicate division of numbers and / to
172 indicate division of symbols.
173 This distinction should not
176 The program contains various arbitrary limits on the length
177 of the units converted and on the length of the data file.
179 The program should use a hash table to store units so that
180 it does not take so long to load the units list and check