[BACK]Return to units.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / units

Annotation of src/usr.bin/units/units.1, Revision 1.10

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