next up previous
Next: The Basic Idea Up: Fully Static Dimensional Analysis Previous: Fully Static Dimensional Analysis

Introduction

There are two aspects to the dimensional analysis of computer programs:

  1. Verifying the dimensional integrity of expressions. This prevents nonsense like adding mass to time.
  2. Provide automatic scaling between quantities. For example, if a quantity in inches is added to a quantity in centimeters, one of the quantities needs to be scaled appropriately before the addition can be performed.

The proposed method provides (1). It circumvents the need for (2), by representing all quantities internally using only a single reference unit (specified by the programmer) for each dimension.gif

The method allows static checking of the dimensional consistency of expressions involving the usual arithmetic and relational operators with negligible run-time overhead (in theory). It is also possible to specify dimensioned literals using arbitrary units, as well as do I/O of dimensioned quantities with full static checking. The term static checking means that the checking is done before run-time: usually at compile-time, but sometimes at link-time.

The sequel assumes that the reader has some familiarity with C++.


next up previous
Next: The Basic Idea Up: Fully Static Dimensional Analysis Previous: Fully Static Dimensional Analysis

zerksis umrigar (zdu@acm.org)
Fri Aug 8 15:41:40 EDT 1997