Annotation of src/usr.bin/units/units.1, Revision 1.12
1.12 ! aaron 1: .\" $OpenBSD: units.1,v 1.11 2000/04/20 23:49:27 pjanzen Exp $
1.4 deraadt 2: .\" converted to new format by deraadt@openbsd.org
3: .Dd July 14, 1993
4: .Dt UNITS 1
5: .Os
6: .Sh NAME
1.5 deraadt 7: .Nm units
1.4 deraadt 8: .Nd conversion program
9: .Sh SYNOPSIS
1.7 aaron 10: .Nm units
1.4 deraadt 11: .Op Fl f Ar filename
12: .Op Fl q
13: .Op Fl v
1.8 aaron 14: .Ar from-unit
1.4 deraadt 15: .Ar to-unit
16: .Sh DESCRIPTION
1.10 aaron 17: The
18: .Nm
1.11 pjanzen 19: program converts quantities expressed in various scales to
1.10 aaron 20: their equivalents in other scales.
21: The
22: .Nm
23: program can only handle multiplicative scale changes.
24: It cannot convert Celsius
25: to Fahrenheit, for example.
1.11 pjanzen 26: It also does not handle logarithmic units such as bels.
1.10 aaron 27: It works interactively by prompting the user for input:
1.4 deraadt 28: .Pp
1.1 deraadt 29: .nf
30: You have: meters
31: You want: feet
32: * 3.2808399
33: / 0.3048
34:
35: You have: cm^3
36: You want: gallons
37: * 0.00026417205
38: / 3785.4118
39: .fi
1.4 deraadt 40: .Pp
1.10 aaron 41: The options are as follows:
42: .Bl -tag -width Ds
43: .It Fl f Ar filename
44: Specifies the name of the units data file to load.
45: .It Fl q
46: Suppresses prompting of the user for units and the display of statistics
47: about the number of units loaded.
48: .It Fl v
49: Prints the version number.
50: .It Ar from-unit Ar to-unit
51: Allows a single unit conversion to be done directly from the command line.
52: No prompting will occur.
53: The units program will print out
54: only the result of this single conversion.
55: .El
56: .Pp
1.8 aaron 57: Powers of units can be specified using the
58: .Ql ^
59: character as shown in
60: the example, or by simple concatenation:
1.9 pjanzen 61: .Sq cm3
1.8 aaron 62: is equivalent to
1.9 pjanzen 63: .Sq cm^3 .
1.1 deraadt 64: Multiplication of units can be specified by using spaces, a dash or
1.10 aaron 65: an asterisk.
66: Division of units is indicated by the slash
1.8 aaron 67: .Pq Ql / .
68: Note that multiplication has a higher precedence than division, so
1.9 pjanzen 69: .Sq m/s/s
1.8 aaron 70: is the same as
1.9 pjanzen 71: .Sq m/s^2
1.8 aaron 72: or
1.9 pjanzen 73: .Sq m/s s .
1.1 deraadt 74: If the user enters incompatible unit types, the units program will
75: print a message indicating that the units are not conformable and
76: it will display the reduced form for each unit:
1.4 deraadt 77: .Pp
1.1 deraadt 78: .nf
79: You have: ergs/hour
1.8 aaron 80: You want: fathoms kg^2 / day
1.1 deraadt 81: conformability error
82: 2.7777778e-11 kg m^2 / sec^3
83: 2.1166667e-05 kg^2 m / sec
84: .fi
1.4 deraadt 85: .Pp
1.10 aaron 86: The conversion information is read from a units data file.
87: The default file includes definitions for most familiar units,
88: abbreviations and metric prefixes.
89: Some constants of nature included are:
1.4 deraadt 90: .Bl -tag -width mercury
91: .It pi
92: ratio of circumference to diameter
93: .It c
94: speed of light
95: .It e
96: charge on an electron
97: .It g
98: acceleration of gravity
99: .It force
100: same as g
101: .It mole
102: Avogadro's number
103: .It water
1.9 pjanzen 104: pressure per unit height of water (at 4 C)
1.4 deraadt 105: .It mercury
106: pressure per unit height of mercury
1.9 pjanzen 107: .It ao
108: Bohr radius
109: .It AU
1.4 deraadt 110: astronomical unit
111: .El
112: .Pp
1.9 pjanzen 113: .Sq Pound
1.10 aaron 114: is a unit of mass.
115: Compound names are run together so
1.9 pjanzen 116: .Sq poundforce
1.10 aaron 117: is a unit of force.
118: British units that differ from their US counterparts are prefixed with
1.9 pjanzen 119: .Sq br ,
120: and currency is prefixed with its country name:
121: .Sq belgiumfranc ,
122: .Sq britainpound .
123: When searching for
1.1 deraadt 124: a unit, if the specified string does not appear exactly as a unit
1.9 pjanzen 125: name, then the units program will try to remove a trailing
126: .Sq s
127: or a trailing
128: .Sq es
129: and check again for a match.
1.4 deraadt 130: .Pp
1.1 deraadt 131: All of these definitions can be read in the standard units file, or you
1.10 aaron 132: can supply your own file.
133: A unit is specified on a single line by
134: giving its name and an equivalence.
135: One should be careful to define
1.1 deraadt 136: new units in terms of old ones so that a reduction leads to the
1.8 aaron 137: primitive units which are marked with
138: .Ql !
139: characters.
1.1 deraadt 140: The units program will not detect infinite loops that could be caused
141: by careless unit definitions.
1.4 deraadt 142: .Pp
1.8 aaron 143: Prefixes are defined in the same way as standard units, but with
1.10 aaron 144: a trailing dash at the end of the prefix name.
145: Prefixes are applied
1.9 pjanzen 146: after the longest matching unit name is found; for example,
147: .Dq nmile
148: is taken to be a nautical mile rather than a nanomile.
1.12 ! aaron 149: .Sh FILES
! 150: .Bl -tag -width /usr/share/misc/units.lib
! 151: .It Pa /usr/share/misc/units.lib
! 152: the standard units library
! 153: .El
! 154: .Sh AUTHORS
! 155: Adrian Mariano (adrian@cam.cornell.edu or mariano@geom.umn.edu)
1.4 deraadt 156: .Sh BUGS
1.8 aaron 157: The effect of including a
158: .Ql /
159: in a prefix is surprising.
1.4 deraadt 160: .Pp
1.9 pjanzen 161: Exponents of units entered by the user can be only one digit.
1.1 deraadt 162: You can work around this by multiplying several terms.
1.4 deraadt 163: .Pp
1.10 aaron 164: The user must use
165: .Ql |
166: to indicate division of numbers and
167: .Ql /
168: to indicate division of symbols.
169: This distinction should not be necessary.
1.9 pjanzen 170: .Pp
171: Prefixes specified without a unit are treated as dimensionless quantities.
172: This can lead to confusion when some prefixes are also defined as units
1.10 aaron 173: (e.g., m).
174: For example, Tera- / Giga- is 1000, but one Tesla (T) is 10,000
1.9 pjanzen 175: Gauss (G).
176: .Pp
177: Some non-SI units have multiple definitions (e.g, barrel, calorie) and
1.10 aaron 178: others have changed over time (e.g., cubit).
179: In particular, monetary values fluctuate.
1.4 deraadt 180: .Pp
1.1 deraadt 181: The program contains various arbitrary limits on the length
182: of the units converted and on the length of the data file.
1.4 deraadt 183: .Pp
1.1 deraadt 184: The program should use a hash table to store units so that
185: it doesn't take so long to load the units list and check
1.8 aaron 186: for duplication.