Rounding of Fixed Point in Ada

utzoo!decvax!harpo!npoiv!alice!mhtsa!eagle!cw utzoo!decvax!harpo!npoiv!alice!mhtsa!eagle!cw
Mon Nov 1 00:27:01 AEST 1982


A recent article refers to Ada fixed point as a kind of
"poor man's floating point."  It is not that at all.
First, it is in the language not because the designers necessarily
wanted it there, but because the language specifications demanded it.
Second, it attempts to provide the facility to manipulate data with a
truly fixed radix point.  The most common instance of this kind
of data is money (with exactly two decimal places in the US), but much 
sensor data also has this property.  Remember that Ada is a
language for programs that handle real world external data.

Third, the radix for fixed point numbers is (implicitly) binary,
albeit the delta can be expressed in decimal.  Finally, although
the rounding rules are not easy to explain for Ada numbers
(either fixed point or floating point), they are considerably
more precise than are the rules in most languages.  Should
a program be one where detailed rounding control is necessary,
Ada is more likely to provide that control than other languages.

If there is to be more Ada discussion, should it be moved to
net.lang.ada?

Charles



More information about the Comp.lang.c mailing list