Contents Up << >>
Physical types
Physical types are used to represent
values of measurement. For example, 3 inches is a measurement of
length. Every physical type has a base unit which is the smallest
possible value of measurement. Every value of that physical type is
some multiple of the base unit. In addition to the base unit other
convenient units can be defined for a physical type by indicating its
relation to the base unit. The only predefined physical type is time.
The physical type definition for the time type is
The range specifies the minimum and
maximum values of the type. The first unit listed is the base unit.
Any other units can be defined by specifying their value as a multiple
of a previously defined unit. A constant value of a physical type must
be a number followed by a unit name indicating the physical type. For
example, if t is defined to be an object of the type time then 1ns,
1sec, or 5fs could all be assigned to t, but 1 could not, since it does
not have a unit name and would thus be an integer.
The grammar rule for a physical type definition is :