Units of Measure


A unit of measure is a definite magnitude of a physical quantity that is used as a standard for measurement of the same physical quantity. Throughout human history, many units have been devised by different cultures to measure the same dimensions in varying ways. Whenever these cultures met to exchange goods, their different units were a frequent source of confusion and arguments over the proper ways to convert between units.

Today, most of these concerns are alleviated by the near universal adoption of the metric system. The major exception. is The United States and countries of the British Commonwealth (to a lesser degree) who still use the "customary" units. But also those using the metric system can disagree on how much resolution is necessary, e.g. 1.5 seconds versus 1500 milliseconds.

ViviFire provides the ability to define units of measure. With this comes compile-time checking of correctness and automatic conversion of values to the expected units.


The representation of a physical quantity has been made to closely resemble the traditional forms used in print. A floating-point number is followed by its unit. The names of all units are case-sensitive—the only part of ViviFire where this happens.

Base units

Derived units

Aliases and SI prefixes

In the physical world, units can have multiple forms, called aliases, where each name can be used interchangably. For example, km is short for kilometer or kilometre.

You can create aliases by listing each form, separated by a space. Additionally, plural forms can easily be specified by placing just the plural suffix in parentheses.

You can specify that a unit is an SI unit by placing the identifier SI, enclosed in parentheses, before the first unit's name. Doing so causes the automatic creation of additional forms with the SI prefixes of magnitude. For a single-letter name, the short prefixes (such as "k-") are prepended. For longer names, the full prefixes (such as "kilo-") are prepended.

Multiple units can have the same name if each unit is derived from different bases. However, when this happens, these units cannot be used to define a variable or parameter to a procedure because of the ambiguity. Therefore, you should try to define aliases that do not conflict.


Unit "SI" meter(s) metre(s) m

The preceding statement creates the following forms:

Dimensionless units