The three forms of floating point rounding are examples of
type demotion. When a real number is rounded it is demoted into
a relatively sparse system of numbers. Although the real number and the
floating point number
are incomparable, the
two numbers may be compared by promotion via the natural
homomorphisms, as follows:
There is a more compact syntax for describing type conversion.
Any number may be converted to another type by attaching the
target type. For example, specifies that the number
a is converted to an extended real number. Type demotion
can be more specific than promotion since there may be several
ways to demote the number. Notice of promotion may be omitted
as in the following example which adds three floating point
numbers a, b, and c:
Jeff Tupper | March 1996 |