1 .\" $NetBSD: units.1,v 1.22 2014/03/18 18:20:45 riastradh Exp $
18 converts quantities expression in various scales to
19 their equivalents in other scales.
21 can only handle multiplicative scale changes.
22 It cannot convert Centigrade to Fahrenheit, for example.
24 The following options and arguments are supported:
25 .Bl -tag -width "-fXfilenameX" -offset indent
27 Specifies the name of the units data file to load.
29 List all unit definitions to the standard output,
30 instead of performing any conversions.
31 The result may include error messages and comments, beginning with
36 option, unit definitions will be listed in a format
37 almost identical to the the units data file that was loaded,
38 except that comments will be removed, spacing may be changed,
39 and lines may be re-ordered.
43 option, all unit definitions will be reduced to a form that
44 depends on only a few primitive units (such as
47 Suppresses prompting of the user for units and the display of statistics
48 about the number of units loaded.
50 Prints the version number.
51 .It Oo Ar count Oc Ar from-unit Ar to-unit
52 Allows a single unit conversion to be done directly from the command
54 No prompting will occur.
56 will print out only the result of this single conversion.
61 as two separate arguments is equivalent to embedding both parts
64 argument, with the parts separated by a space.
68 works interactively by prompting the user for input:
81 Powers of units can be specified using the
83 character as shown in the example, or by simple concatenation:
87 Multiplication of units can be specified by using spaces, a dash or
89 Division of units is indicated by the slash
91 Note that multiplication has a higher precedence than division,
98 If the user enters incompatible unit types, the
100 program will print a message indicating that the units are not
101 conformable and it will display the reduced form for each unit:
104 You want: fathoms kg^2 / day
106 2.7777778e-11 kg m^2 / sec^3
107 2.1166667e-05 kg^2 m / sec
110 The conversion information is read from a units data file.
112 file includes definitions for most familiar units, abbreviations and
114 Some constants of nature included are:
115 .Bl -tag -width mercury -compact -offset indent
117 ratio of circumference to diameter
121 charge on an electron
123 acceleration of gravity
129 pressure per unit height of water
131 pressure per unit height of mercury
138 Compound names are run together
142 British units that differ from their
143 US counterparts are prefixed with
145 and currency is prefixed with
150 a unit, if the specified string does not appear exactly as a unit
153 program will try to remove a trailing
157 and check again for a match.
159 All of these definitions can be read in the standard units file, or you
160 can supply your own file.
161 A unit is specified on a single line by
162 giving its name and an equivalence.
163 One should be careful to define
164 new units in terms of old ones so that a reduction leads to the
165 primitive units which are marked with
169 will not detect infinite loops that could be caused
170 by careless unit definitions.
172 Prefixes are defined in the same way as standard units, but with
173 a trailing dash at the end of the prefix name.
175 .Bl -tag -width /usr/share/misc/units.lib -compact
176 .It Pa /usr/share/misc/units.lib
177 the standard units library
180 .An Adrian Mariano Aq Mt adrian@cam.cornell.edu
182 .Aq mariano@geom.umn.edu
186 can be used as a calculator for many unit-related computations,
187 caution is required: many computations require additional constant
188 factors deriving from the physics (or chemistry or whatever) of the
190 As these factors are dimensionless,
192 cannot itself either provide them or warn the user when they have been
194 For example, one joule is one kilogram meter squared per second
195 squared, by definition; however, the kinetic energy of a one-kilogram
196 object moving at one meter per second is half a joule, not one joule,
197 because of a dimensionless factor that arises from integration.
199 Also, some pairs of units that have the same dimensionality are
200 nonetheless used to measure different things and attempting to convert
201 between them may require additional fudge factors or be entirely
203 For example, torque and energy have the same dimensionality, but
204 attempting to convert torque in newton-meters to energy in joules is
206 There is no practical way for
208 to warn about these issues either.
210 The effect of including a
212 in a prefix is surprising.
214 Exponents entered by the user can be only one digit.
215 You can work around this by multiplying several terms.
219 to indicate division of numbers and
221 to indicate division of symbols.
222 This distinction should not be necessary.
224 The program contains various arbitrary limits on the length
225 of the units converted and on the length of the data file.
227 The program should use a hash table to store units so that
228 it doesn't take so long to load the units list and check