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