UnitCalc Reference


Basic Units

These are the ten base units built into UnitCalc. All other units are derived from these in your prefs.txt file. The user-defined units (u1, u2, and u1) may be defined as whatever you want: people, molecules, roads, etc.

Unit Prefixes

UnitCalc understands the 14 standard prefixes in the metric system, as shown in the tables below. Note that each prefix uses a single letter (e.g., deka is "D" rather than "da") and a few prefixes have two equivalent forms (K, k).

Prefix T G M K or k H or h D
Name tera giga mega kilo hecto deka
Factor 10^12 10^9 10^6 10^3 10^2 10

Prefix d c m or u n p f a
Name deci centi milli micro nano pico femto atto
Factor 10^-1 10^-2 10^-3 10^-6 10^-9 10^-12 10^-15 10^-18


Built-In Functions

At the "in:" prompt, you can either type a quantity (like 42 m sec^-1) to go on the stack, or the name of a function, which performs some operation on the stack. The built-in functions are:

UnitCalc Scripts

With version 0.5, UnitCalc has the ability to read commands from a text file. These are executed just as if you had typed them.

The main use for this is to define derived units and variables you want UnitCalc to use. When UnitCalc starts, it looks for a file called unitcalc.rc in the current directory. If it finds such a file, it is read as a script. The standard unitcalc.rc defines common SI and American derived units; you may wish to customize which ones are used in output, or remove the American units altogether.

There are two ways to create a script:

  1. Enter variables and preferences (via use) in UnitCalc, then use the save command.
  2. Directly create or modify a script with your favorite text editor.

There are also two ways scripts get executed:

  1. If a file name unitcalc.rc exists, it is executed when UnitCalc is started.
  2. You can execute a script at any time with the load command.

NOTE: The new script function replaces the prefs.txt file that was formerly used to define preferred units. prefs.txt is no longer used.


Multiple Commands on One Line

You can give multiple functions or values on a line. Simply separate them by tabs, commas, vertical bars, or newlines (i.e. the Return key, which is the usual situation).