Annotation of src/usr.bin/units/units.1, Revision 1.8
1.8 ! aaron 1: .\" $OpenBSD: units.1,v 1.7 1998/12/16 02:38:50 aaron 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 ARGUMENTS
17: .Bl -tag -width Ds
18: .It Fl f Ar filename
1.1 deraadt 19: Specifies the name of the units data file to load.
1.8 ! aaron 20: .It Fl q
1.1 deraadt 21: Suppresses prompting of the user for units and the display of statistics
22: about the number of units loaded.
1.8 ! aaron 23: .It Fl v
1.1 deraadt 24: Prints the version number.
1.4 deraadt 25: .It Ar from-unit Ar to-unit
1.1 deraadt 26: Allows a single unit conversion to be done directly from the command
27: line. No prompting will occur. The units program will print out
28: only the result of this single conversion.
1.4 deraadt 29: .El
30: .Sh DESCRIPTION
1.8 ! aaron 31: The units program converts quantities expression in various scales to
1.1 deraadt 32: their equivalents in other scales. The units program can only
33: handle multiplicative scale changes. It cannot convert Centigrade
34: to Fahrenheit, for example. It works interactively by prompting
35: the user for input:
1.4 deraadt 36: .Pp
1.1 deraadt 37: .nf
38: You have: meters
39: You want: feet
40: * 3.2808399
41: / 0.3048
42:
43: You have: cm^3
44: You want: gallons
45: * 0.00026417205
46: / 3785.4118
47: .fi
1.4 deraadt 48: .Pp
1.8 ! aaron 49: Powers of units can be specified using the
! 50: .Ql ^
! 51: character as shown in
! 52: the example, or by simple concatenation:
! 53: .Dq cm3
! 54: is equivalent to
! 55: .Dq cm^3 .
1.1 deraadt 56: Multiplication of units can be specified by using spaces, a dash or
1.8 ! aaron 57: an asterisk. Division of units is indicated by the slash
! 58: .Pq Ql / .
! 59: Note that multiplication has a higher precedence than division, so
! 60: .Dq m/s/s
! 61: is the same as
! 62: .Dq m/s^2
! 63: or
! 64: .Dq m/s s .
1.1 deraadt 65: If the user enters incompatible unit types, the units program will
66: print a message indicating that the units are not conformable and
67: it will display the reduced form for each unit:
1.4 deraadt 68: .Pp
1.1 deraadt 69: .nf
70: You have: ergs/hour
1.8 ! aaron 71: You want: fathoms kg^2 / day
1.1 deraadt 72: conformability error
73: 2.7777778e-11 kg m^2 / sec^3
74: 2.1166667e-05 kg^2 m / sec
75: .fi
1.4 deraadt 76: .Pp
1.1 deraadt 77: The conversion information is read from a units data file. The default
78: file includes definitions for most familiar units, abbreviations and
79: metric prefixes. Some constants of nature included are:
1.4 deraadt 80: .Bl -tag -width mercury
81: .It pi
82: ratio of circumference to diameter
83: .It c
84: speed of light
85: .It e
86: charge on an electron
87: .It g
88: acceleration of gravity
89: .It force
90: same as g
91: .It mole
92: Avogadro's number
93: .It water
94: pressure per unit height of water
95: .It mercury
96: pressure per unit height of mercury
97: .It au
98: astronomical unit
99: .El
100: .Pp
1.1 deraadt 101: \'Pound' is a unit of mass. Compound names are run together
102: so 'poundforce' is a unit of force. British units that differ from their
103: US counterparts are prefixed with 'br', and currency is prefixed with
104: its country name: 'belgiumfranc', 'britainpound'. When searching for
105: a unit, if the specified string does not appear exactly as a unit
106: name, then the units program will try to remove a trailing 's' or
1.8 ! aaron 107: a trailing 'es' and check again for a match.
1.4 deraadt 108: .Pp
1.1 deraadt 109: All of these definitions can be read in the standard units file, or you
110: can supply your own file. A unit is specified on a single line by
111: giving its name and an equivalence. One should be careful to define
112: new units in terms of old ones so that a reduction leads to the
1.8 ! aaron 113: primitive units which are marked with
! 114: .Ql !
! 115: characters.
1.1 deraadt 116: The units program will not detect infinite loops that could be caused
117: by careless unit definitions.
1.4 deraadt 118: .Pp
1.8 ! aaron 119: Prefixes are defined in the same way as standard units, but with
! 120: a trailing dash at the end of the prefix name.
1.4 deraadt 121: .Sh BUGS
1.8 ! aaron 122: The effect of including a
! 123: .Ql /
! 124: in a prefix is surprising.
1.4 deraadt 125: .Pp
1.1 deraadt 126: Exponents entered by the user can be only one digit.
127: You can work around this by multiplying several terms.
1.4 deraadt 128: .Pp
1.1 deraadt 129: The user must use | to indicate division of numbers and / to
130: indicate division of symbols. This distinction should not
131: be necessary.
1.4 deraadt 132: .Pp
1.1 deraadt 133: The program contains various arbitrary limits on the length
134: of the units converted and on the length of the data file.
1.4 deraadt 135: .Pp
1.1 deraadt 136: The program should use a hash table to store units so that
137: it doesn't take so long to load the units list and check
1.8 ! aaron 138: for duplication.
1.4 deraadt 139: .Sh FILES
1.1 deraadt 140: /usr/share/misc/units.lib - the standard units library
1.4 deraadt 141: .Sh AUTHOR
1.1 deraadt 142: Adrian Mariano (adrian@cam.cornell.edu or mariano@geom.umn.edu)