From: CONTR47@NOSC-TECR.ARPA
Subject: Ada decimal math, an example (or counterexample)
Date: 30 Jun 88 21:53:04 GMT [thread overview]
Message-ID: <8806302150.AA13730@ajpo.sei.cmu.edu> (raw)
with text_io; use text_io;
procedure decimal is
type dollar_type is delta 0.01 range 0.00..1000.00;
package decimal_io is new fixed_io(dollar_type); use decimal_io;
my_dime : dollar_type :=
0.01 + 0.01 + 0.01 + 0.01 + 0.01 + 0.01 + 0.01 + 0.01 + 0.01 + 0.01;
-- 1 2 3 4 5 6 7 8 9 10
your_dime : dollar_type := 0.0;
begin
for i in 1..10 loop
your_dime := your_dime + 0.01;
end loop;
put("-- my_dime is worth "); put ( my_dime ); new_line;
put("--your_dime is worth "); put ( your_dime ); new_line;
end decimal;
-- Janus 2.0.2 prints:
-- my_dime is worth 0.08 (Janus apparently isn't doing universal math)
--your_dime is worth 0.08
-- Alsys v3.2 prints:
-- my_dime is worth 0.10
-- your_dime is worth 0.08
-- Verdix (VADS Version 5.41 ) prints:
-- my_dime is worth 0.10
-- your_dime is worth 0.07 (apparently it truncates on I/O)
--Dec version 1.3 prints:
-- my_dime is worth 0.08 (apparently isn't doing universal math)
-- your_dime is worth 0.08
--Since Dec says my_dime is worth 0.08 I now question whether
--Universal math is required for the initialization. Maybe
--only Alsys is doing the my_dime computation at compile time
--and therefore using Universal math and the others are doing
--it at run time using model numbers. What do you experts say?
--I formally withdraw my suggestion to perform computation
--in the declarative region in order to have it done by
--universal math. Sigh.
--regards,sam harbaugh
----------------------
next reply other threads:[~1988-06-30 21:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1988-06-30 21:53 CONTR47 [this message]
-- strict thread matches above, loose matches on Subject: below --
1988-07-01 17:54 Ada decimal math, an example (or counterexample) Norman Cohen
1988-07-06 18:48 Gary Morris @flash
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox