Ada Decimal Arithmethic and Representations
Among the application domains for which Ada is being used or is
under consideration, is the traditional COBOL domain of business data
processing. However, Ada's arithmetic type facility does not readily
handle the exact decimal model needed for financial computation, leaving
a major impediment to a successful transition to Ada for Information
Systems applications. The ADAR project addresses this shortcoming by
providing a set of packages that define and implement decimal support in
Ada 83. The ADAR packages include support for decimal data with up to
18 digits of precision, arithmetic operations with programmer control
over rounding versus truncation, conversions to and from common external
representations, and formatted output of decimal values based on COBOL's
"picture" clauses. The ADAR packages offer a portable interface via a
set of unit specifications, and a portable (although not necessarily
efficient) reference implementation.
ADAR provides two approaches to decimal arithmetic: one through a
discriminated private type, where discriminants establish precision (the
number of digits) and scale (the number of digits to the right of the
decimal point); and another through generic packages, where the effect
of precision and scale is established via generic instantiation. For
details on the two approaches, refer to the accompanying report in the
SUMMARY.TXT file. Users can employ either or both of the approaches in
their programs.
The design and development of ADAR was conducted by Mr. Robert
Eachus and Mr. David Emery from the MITRE Corporation, and by Dr.
Benjamin Brosgol.