Data types of physical quantities
Johannes J. Martin · 2002
Quantities of classical physics such as distance, time, energy, etc. are commonly viewed as pairs (d, u) consisting of a dimension and a unit. Computer programs that operate on physical quantities manipulate only the dimensions; units must be dealt with by comments. This article proposes a type system that makes the units an integral part of a program and, consequently, protects against errors resulting from "adding apples and oranges", and supports appropriate self-documentation. It shows that engineering types have a simple, algebraic structure that makes a homogeneous type system for them not only desirable but also feasible at a very small expense.