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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f523c5e0f604e44 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: GNAT 3.05 distribution, Float Exception Handling Error Date: 1996/09/16 Message-ID: <01bba3d5$fd945960$238371a5@dhoossr>#1/1 X-Deja-AN: 181116130 distribution: world references: <51ic3u$t7r@newsbf02.news.aol.com> organization: DBH Enterprises, Inc. newsgroups: comp.lang.ada Date: 1996-09-16T00:00:00+00:00 List-Id: JRMONROE wrote in article <51ic3u$t7r@newsbf02.news.aol.com>... > I use a 486/66, 16megs ram, Dos ver 6.22, wFw3.11, also win95 ,but the > win95 gnat works fine. The dos gnat305 is not working for this floating > point error. I tried the following code and it gives me the following > error: > > with ada.text_io, ada.float_text_IO; > use ada.text_io, ada.float_text_io; > procedure Testing is > -- declarations > a:float:=20.0; > b:float:=5.0; > c:float:=0.0; > > test:exception; > begin > -- statements > begin -- begin block > put_line("THIS IS A TEST"); > new_line; > put("20/5= "); > put(a/b); > new_line; > put("20/0="); > put(a/c); > exception > when constraint_error => > put_line("CONSTRAINT ERROR"); > when others => > put_line("some other error was made"); > > end; --block > Put_line("THIS SHOULD BE AFTER EXCEPTION!!"); > > end Testing; Hi, I don't have gnat305 for DOS running on my machine, so I can't verify the behavior. However, there is a workround, suggested by the following excerpt from the Ada95 Rationale. If the problem is real on gnat305 for DOS, you should send e-mail to gnat.com, as directed in the gnat documentation. ---------------------------- Ada 95 Rationale excerpt begins -------------------------------- 11.1 Numeric Error Those familiar with the early use of Ada 83 will recall that there was considerable confusion between Numeric_Error and Constraint_Error in a number of corner situations. As a consequence the ARG ruled that implementations should raise Constraint_Error in all situations for which Numeric_Error was originally intended. This was a non-binding interpretation with the intention of making it binding in due course. Essentially all implementations of Ada 83 now raise Constraint_Error although for historic reasons some programs may contain dormant handlers for Numeric_Error. The development of Ada 95 provided an opportunity to remove this historic wart once and for all. It was thus proposed that Numeric_Error be completely removed. However, many reviewers pointed out that those programs which had conformed to the advice of AI-387 by consistently writing when Constraint_Error | Numeric_Error => would then become illegal. Accordingly, in Ada 95, Numeric_Error is simply a renaming of Constraint_Error. Such a change alone would still have made the above illegal because, in Ada 83, all the exceptions in a handler had to be distinct; a supplementary change is thus that an exception may appear more than once in a handler in Ada 95. Allowing multiple instances of an exception in a given handler has benefits in other areas. It now allows sequences such as when Text_IO.Data_Error | Integer_IO.Data_Error => where there may be documentation advantages in revealing the potential causes of the exception. Of course if the user had deliberately relied upon a distinction between Numeric_Error and Constraint_Error then the program will now become incorrect. It may be simply incompatible but may also be inconsistent if the handlers are in different frames. For a more detailed discussion see A-4.5. Despite this possibility it was concluded that the perhaps safer alternative of completely removing Numeric_Error was not appropriate for this revision although it should be reconsidered at the next revision. ---------------------------- Ada 95 Rationale excerpt ends -------------------------------- Hope this helps -- David C. Hoos, Sr., http://www.dbhwww.com http://www.ada95.com >