From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!husc6!mailrus!ames!pacbell!att!ucbvax!NOSC-TECR.ARPA!CONTR47 From: CONTR47@NOSC-TECR.ARPA Newsgroups: comp.lang.ada Subject: Ada decimal math, an example (or counterexample) Message-ID: <8806302150.AA13730@ajpo.sei.cmu.edu> Date: 30 Jun 88 21:53:04 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: 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 ----------------------