From: re@hades.NoSubdomain.NoDomain (Rolf EBERT)
Subject: Re: Ada Decimal Arithmetic & Representations (ADAR) V1.0 available
Date: Mon, 22 Mar 93 09:53:01 GMT
Date: 1993-03-22T09:53:01+00:00 [thread overview]
Message-ID: <1993Mar22.095301.806@enpc.fr> (raw)
In-Reply-To: 1993Mar21.231233.2934@seas.gwu.edu
In article <1993Mar21.231233.2934@seas.gwu.edu>, mfeldman@seas.gwu.edu (Michael Feldman) writes:
|> In article <1993Mar19.161646.26563@sei.cmu.edu> adainfo@ajpo.sei.cmu.edu (Michele L. Kee (AdaIC)) writes:
|> >
|> >The ADAR packages were developed to provide a common approach for
|> >decimal arithmetic and Ada 83. The ADAR package set consists of two
|> >related facilities for decimal arithmetic, one based on discriminant
|> >records, and the other on generics, to provide decimal computation and
|> >interoperable representations of decimal quantities.
|> >
|> >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.
|> >
|> I have been working with ADAR off and on for a month or so, and find it
|> an extraordinarily interesting artifact for educational purposes because
|> there is some very good Ada in it. I believe that it is also useful in
|> its own right as a facility for adding IS features to Ada83. You can view it
|> as a preview of some of the IS facilities in Ada9X.
|>
|> Ben Brosgol, Dave Emery, and Bob Eachus have done a great job of producing
|> this software and deserve our commendation. That said, I wish to express
|> some disappointment at the limited number of compilers for which ADAR
|> has been tested. The Meridian family is the most common family of compilers
|> in education, and ADAR dos not (yet) work under Meridian; preliminary
|> tests indicate that at least some compilation-order problems will need to
|> be resolved.
|>
|> To operate under Ada/Ed, ADAR will need a good bit more work; there are
|> (I think) some capacity problems as well as the Ada/Ed requirement (which
|> used to be common in Ada compilers) that a generic body appear in the
|> same file as the associated generic spec.
|>
|> Perhaps we at GW will find the time to re-work ADAR for these two
|> important education-oriented Ada systems; perhaps someone in net-land
|> will. Whatever, I commend ADAR to you as a neat bunch of stuff.
|>
|> Mike Feldman
|> ------------------------------------------------------------------------
|> Michael B. Feldman
|> co-chair, SIGAda Education Committee
|>
|> Professor, Dept. of Electrical Engineering and Computer Science
|> School of Engineering and Applied Science
|> The George Washington University
|> Washington, DC 20052 USA
|> (202) 994-5253 (voice)
|> (202) 994-5296 (fax)
|> mfeldman@seas.gwu.edu (Internet)
|>
|> "The most important thing is to be sincere,
|> and once you've learned how to fake that, you've got it made."
|> -- old show-business adage
|> ------------------------------------------------------------------------
I tried the package with the Alsys compiler (V5.5.1) on a SPARC station and had
no difficulties to compile it. The only problem was a shortcoming of the Alsys
compiler that defines no Long_Integer. Context-fiffs are applied at the end.
diff -c3 -r ADAR/examples/generic/exercise/decpck.ada ADAR.new/examples/generic/exercise/decpck.ada
*** ADAR/examples/generic/exercise/decpck.ada Mon Mar 15 20:03:23 1993
--- ADAR.new/examples/generic/exercise/decpck.ada Sat Mar 20 15:04:39 1993
***************
*** 1,2 ****
with ADAR_Generic_Decimal;
! package Decimal_Pckg is new ADAR_Generic_Decimal (Long_Integer, Long_Float);
--- 1,2 ----
with ADAR_Generic_Decimal;
! package Decimal_Pckg is new ADAR_Generic_Decimal (Integer, Long_Float);
diff -c3 -r ADAR/examples/generic/exercise/example1.ada ADAR.new/examples/generic/exercise/example1.ada
*** ADAR/examples/generic/exercise/example1.ada Mon Mar 15 20:03:43 1993
--- ADAR.new/examples/generic/exercise/example1.ada Sat Mar 20 15:43:55 1993
***************
*** 20,26 ****
subtype Fraction is Fraction_Type.Decimal;
use Fraction_Type;
! subtype Years is Long_Integer;
Input_File, Output_File : Text_IO.File_Type;
--- 20,26 ----
subtype Fraction is Fraction_Type.Decimal;
use Fraction_Type;
! subtype Years is Integer;
Input_File, Output_File : Text_IO.File_Type;
***************
*** 38,44 ****
(Fraction, Fraction_Type.Default_Format);
function "**" (L : Fraction;
! R : Long_Integer) return Fraction is
use Fraction_Log;
begin
return Exp (R * Log (L));
--- 38,44 ----
(Fraction, Fraction_Type.Default_Format);
function "**" (L : Fraction;
! R : Integer) return Fraction is
use Fraction_Log;
begin
return Exp (R * Log (L));
***************
*** 84,90 ****
use Text_IO;
begin
Put (File, '$');
! Long_Int_IO.Put (File, Long_Integer (Dollars_Type.Float (P)), 4);
Long_Int_IO.Put (File, T, 9); -- six spaces plus two digits.
Fraction_IO.Put (File, Item => R * 100);
-- The multiplication by 100 is to convert to a percentage.
--- 84,90 ----
use Text_IO;
begin
Put (File, '$');
! Long_Int_IO.Put (File, Integer (Dollars_Type.Float (P)), 4);
Long_Int_IO.Put (File, T, 9); -- six spaces plus two digits.
Fraction_IO.Put (File, Item => R * 100);
-- The multiplication by 100 is to convert to a percentage.
diff -c3 -r ADAR/examples/generic/exercise/example2.ada ADAR.new/examples/generic/exercise/example2.ada
*** ADAR/examples/generic/exercise/example2.ada Mon Mar 15 20:04:10 1993
--- ADAR.new/examples/generic/exercise/example2.ada Sat Mar 20 15:06:57 1993
***************
*** 1,3 ****
--- 1,4 ----
+
with Adar_Formats;
with Text_IO;
with Long_Int_IO;
***************
*** 24,30 ****
subtype Fraction is Fraction_Type.Decimal;
use Fraction_Type;
! subtype Shares is Long_Integer;
package Price_Type is new Decimal_Pckg.Short_Decimal
(Decimal_Places => 2,
--- 25,31 ----
subtype Fraction is Fraction_Type.Decimal;
use Fraction_Type;
! subtype Shares is Integer;
package Price_Type is new Decimal_Pckg.Short_Decimal
(Decimal_Places => 2,
diff -c3 -r ADAR/examples/generic/exercise/example3.ada ADAR.new/examples/generic/exercise/example3.ada
*** ADAR/examples/generic/exercise/example3.ada Mon Mar 15 20:04:32 1993
--- ADAR.new/examples/generic/exercise/example3.ada Mon Mar 22 09:51:36 1993
***************
*** 68,74 ****
begin
-- 0--------1---------2---------3---------4---------5---------6---
-- 123456789012345678901234567890123456789012345678901234567890123
! Put (" WEST GERMAN AUTOMOBILE IMPORT COSTS (U.S.$1 = DM ");
Fraction_IO.Put (Deutschmarks_Per_Dollar, Conversion_Format);
Put_Line (")");
New_Line;
--- 68,74 ----
begin
-- 0--------1---------2---------3---------4---------5---------6---
-- 123456789012345678901234567890123456789012345678901234567890123
! Put (" GERMAN AUTOMOBILE IMPORT COSTS (U.S.$1 = DM ");
Fraction_IO.Put (Deutschmarks_Per_Dollar, Conversion_Format);
Put_Line (")");
New_Line;
diff -c3 -r ADAR/examples/generic/exercise/lint_io.ada ADAR.new/examples/generic/exercise/lint_io.ada
*** ADAR/examples/generic/exercise/lint_io.ada Mon Mar 15 20:04:36 1993
--- ADAR.new/examples/generic/exercise/lint_io.ada Sat Mar 20 15:05:17 1993
***************
*** 1,2 ****
with Text_IO;
! package Long_Int_IO is new Text_IO.Integer_IO(Long_Integer);
--- 1,2 ----
with Text_IO;
! package Long_Int_IO is new Text_IO.Integer_IO(Integer);
diff -c3 -r ADAR/intrface/except.ada ADAR.new/intrface/except.ada
*** ADAR/intrface/except.ada Mon Mar 15 18:15:08 1993
--- ADAR.new/intrface/except.ada Sat Mar 20 15:50:40 1993
***************
*** 20,22 ****
--- 20,25 ----
-- of an unchecked conversion by the programmer
end ADAR_Exceptions;
+
+ package body ADAR_Exceptions is
+ end ADAR_Exceptions;
Rolf
-----------------------------------------------------------------------------
Rolf Ebert Groupe Informatique et Systemes Energetiques GISE EMP-ENPC
Tel: +33 1 43044098 app 3475 FAX: +33 1 43046364 La Courtine Cedex
Internet: ebert@enpc.fr F-93167 Noisy le Grand
-----------------------------------------------------------------------------
next prev parent reply other threads:[~1993-03-22 9:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-03-19 21:16 Ada Decimal Arithmetic & Representations (ADAR) V1.0 available Michele L. Kee (AdaIC)
1993-03-21 23:12 ` Michael Feldman
1993-03-22 9:53 ` Rolf EBERT [this message]
1993-03-22 22:33 ` Keith Thompson @pulsar
1993-03-24 1:33 ` Robert I. Eachus
1993-03-25 1:22 ` Keith Thompson @pulsar
1993-03-25 21:29 ` Robert I. Eachus
1993-03-25 22:02 ` But it is possible Robert I. Eachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox