DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(units.info.gz) Unit expressions

Info Catalog (units.info.gz) Command line use (units.info.gz) Top (units.info.gz) Invoking units
 
 Unit expressions
 ****************
 
    In order to enter more complicated units or fractions, you will need
 to use operations such as powers, products and division.  Powers of
 units can be specified using the `^' character as shown in the
 following example, or by simple concatenation: `cm3' is equivalent to
 `cm^3'.  If the exponent is more than one digit, the `^' is required.
 An exponent like `2^3^2' is evaluated right to left.  The `^' operator
 has the second highest precedence.
 
          You have: cm^3
          You want: gallons
                  * 0.00026417205
                  / 3785.4118
      
          You have: arabicfoot-arabictradepound-force
          You want: ft lbf
                  * 0.7296
                  / 1.370614
 
    Multiplication of units can be specified by using spaces, a hyphen
 (`-') or an asterisk (`*').  Division of units is indicated by the
 slash (`/') or by `per'.
 
          You have: furlongs per fortnight
          You want: m/s
                  * 0.00016630986
                  / 6012.8727
 
    Multiplication has a higher precedence than division and is evaluated
 left to right, so `m/s * s/day' is equivalent to `m / s s day' and has
 dimensions of length per time cubed.  Similarly, `1/2 meter' refers to
 a unit of reciprocal length equivalent to .5/meter, which is probably
 not what you would intend if you entered that expression.  You can
 indicate division of numbers with the vertical dash (`|').  This
 operator has the highest precedence so the square root of two thirds
 could be written `2|3^1|2'.
 
          You have: 1|2 inch
          You want: cm
                  * 1.27
                  / 0.78740157
 
 Parentheses can be used for grouping as desired.
 
          You have: (1/2) kg / (kg/meter)
          You want: league
                  * 0.00010356166
                  / 9656.0833
 
    Prefixes are defined separately from base units.  In order to get
 centimeters, the units database defines `centi-' and `c-' as prefixes.
 Prefixes can appear alone with no unit following them.  An exponent
 applies only to the immediately preceding unit and its prefix so that
 `cm^3' or `centimeter^3' refer to cubic centimeters but `centi-meter^3'
 refers to hundredths of cubic meters.  Only one prefix is permitted per
 unit, so `micromicrofarad' will fail, but `micro-microfarad' will work.
 
    For `units', numbers are just another kind of unit.  They can appear
 as many times as you like and in any order in a unit expression.  For
 example, to find the volume of a box which is 2 ft by 3 ft by 12 ft in
 steres, you could do the following:
 
          You have: 2 ft 3 ft 12 ft
          You want: stere
                  * 2.038813
                  / 0.49048148
      
          You have: $ 5 / yard
          You want: cents / inch
                  * 13.888889
                  / 0.072
 
 And the second example shows how the dollar sign in the units conversion
 can precede the five.  Be careful:  `units' will interpret `$5' with no
 space as equivalent to dollars^5.
 
    Outside of the SI system, it is often desirable to add values of
 different units together.  Sums of conformable units are written with
 the `+' character.
 
          You have: 2 hours + 23 minutes + 32 seconds
          You want: seconds
                  * 8612
                  / 0.00011611705
      
          You have: 12 ft + 3 in
          You want: cm
                  * 373.38
                  / 0.0026782366
      
          You have: 2 btu + 450 ft-lbf
          You want: btu
                  * 2.5782804
                  / 0.38785542
 
 The expressions which are added together must reduce to identical
 expressions in primitive units, or an error message will be displayed:
 
          You have: 12 printerspoint + 4 heredium
                                                ^
          Illegal sum of non-conformable units
 
 Because `-' is used for products, it cannot also be used to form
 differences of units.  If a `-' appears after `(' or after `+' then it
 will act as a negation operator.  So you can compute 20 degrees minus
 12 minutes by entering `20 degrees + -12 arcmin'.  The `+' character is
 sometimes used in exponents like `3.43e+8'.  This leads to an ambiguity
 in an expression like `3e+2 yC'.  The unit `e' is a small unit of
 charge, so this can be regarded as equivalent to `(3e+2) yC' or `(3
 e)+(2 yC)'.  This ambiguity is resolved by always interpreting `+' as
 part of an exponent if possible.
 
    Several built in functions are provided: `sin', `cos', `tan', `ln',
 `log', `log2', `exp', `acos', `atan' and `asin'.  The `sin', `cos', and
 `tan' functions require either a dimensionless argument or an argument
 with dimensions of angle.
 
          You have: sin(30 degrees)
          You want:
                  Definition: 0.5
      
          You have: sin(pi/2)
          You want:
                  Definition: 1
      
          You have: sin(3 kg)
                            ^
          Unit not dimensionless
 
 The other functions on the list require dimensionless arguments.  The
 inverse trigonometric functions return arguments with dimensions of
 angle.
 
    If you wish to take roots of units, you may use the `sqrt' or
 `cuberoot' functions.  These functions require that the argument have
 the appropriate root.  Higher roots can  be obtained by using
 fractional exponents:
 
          You have: sqrt(acre)
          You want: feet
                  * 208.71074
                  / 0.0047913202
      
          You have: (400 W/m^2 / stefanboltzmann)^(1/4)
          You have:
                  Definition: 289.80882 K
      
          You have: cuberoot(hectare)
                                    ^
          Unit not a root
 
    Nonlinear units are represented using functional notation.  They
 make possible nonlinear unit conversions such temperature.  This is
 different from the linear units that convert temperature differences.
 Note the difference below.  The absolute temperature conversions are
 handled by units starting with `temp', and you must use functional
 notation.  The temperature differences are done using units starting
 with `deg' and they do not require functional notation.
 
          You have: tempF(45)
          You want: tempC
                  7.2222222
      
          You have: 45 degF
          You want: degC
                  * 25
                  / 0.04
 
    In this case, think of `tempF(x)' not as a function but as a
 notation which indicates that `x' should have units of `tempF' attached
 to it.   Nonlinear units.
 
    Some other examples of nonlinears units are ring size and wire gauge.
 There are numerous different gauges and ring sizes.  See the units
 database for more details.  Note that wire gauges with multiple zeroes
 are signified using negative numbers where two zeroes is -1.
 Alternatively, you can use the synonyms `g00', `g000', and so on that
 are defined in the units database.
 
          You have: wiregauge(11)
          You want: inches
                  * 0.090742002
                  / 11.020255
      
          You have: brwiregauge(g00)
          You want: inches
                  * 0.348
                  / 2.8735632
      
          You have: 1 mm
          You want: wiregauge
                  18.201919
 
Info Catalog (units.info.gz) Command line use (units.info.gz) Top (units.info.gz) Invoking units
automatically generated byinfo2html