Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ (1) — Plan9 4th Edition

Media Vault

Software Library

Restoration Projects

Artifacts Sought

UNITS(1)

NAME

units − conversion program

SYNOPSIS

­units [ ­-v ] [ ­file ]

DESCRIPTION

­Units converts quantities expressed in various standard scales to their equivalents in other scales.  It works interactively in this fashion:

you have: inch
you want: cm
    ∗ 2.54
    / 0.393701

A quantity is specified as a multiplicative combination of units and floating point numbers.  Operators have the following precedence:

+ -add and subtract
∗ / × ÷multiply and divide
catenationmultiply
² ³ ^exponentiation
|divide
( ... )grouping

Most familiar units, abbreviations, and metric prefixes are recognized, together with a generous leavening of exotica and a few constants of nature including:

pi,πratio of circumference to diameter
cspeed of light
echarge on an electron
gacceleration of gravity
forcesame as g
moleAvogadro’s number
waterpressure head per unit height of water
auastronomical unit

The ­pound is a unit of mass.  Compound names are run together, e.g.  lightyear.  British units that differ from their US counterparts are prefixed thus: brgallon.  Currency is denoted belgiumfranc, britainpound, etc. 

The complete list of units can be found in /lib/units.  A ­file argument to ­units specifies a file to be used instead of /lib/units.  The ­-v flag causes ­units to print its entire database. 

EXAMPLE

you have: 15 pounds force/in²
you want: atm
    ∗ 1.02069
    / .97973

FILES

­/lib/units

SOURCE

­/sys/src/cmd/units.y

BUGS

Since ­units does only multiplicative scale changes, it can convert Kelvin to Rankine but not Centigrade to Fahrenheit. 

Currency conversions are only as accurate as the last time someone updated the database. 

Plan 9  —  April 17, 2005

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026