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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f6be630961a327bf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-09-10 00:39:42 PST Path: supernews.google.com!sn-xit-02!sn-xit-01!supernews.com!europa.netcrusader.net!194.176.220.129!newsfeed.icl.net!news-lond.gip.net!news-raspail.gip.net!news.gsl.net!gip.net!grolier!club-internet!not-for-mail From: Laurent Guerby Newsgroups: comp.lang.ada Subject: Re: C++ to Ada95 -- bitten! Date: 10 Sep 2000 09:39:30 +0200 Organization: Club-Internet (France) Message-ID: <867l8kelvx.fsf@acm.org> References: <6oBu5.666$zo.17816@news1.mts.net> NNTP-Posting-Host: nas8-143.vlt.club-internet.fr X-Trace: front2m.grolier.fr 968571506 11432 194.158.111.143 (10 Sep 2000 07:38:26 GMT) NNTP-Posting-Date: 10 Sep 2000 07:38:26 GMT X-Newsreader: Gnus v5.7/Emacs 20.5 Xref: supernews.google.com comp.lang.ada:569 Date: 2000-09-10T07:38:26+00:00 List-Id: "Nick J Chackowsky" writes: > Ahaaaa... the _compiler_ attempted to "solve" the poorly formed exponent and > crashed in the attempt? That's likely to be the explanation. Note that the compiler is required by the standard to be exact for static numerical computations. The following code should print 1.0 on all Ada 95 compilers (and the constant will be generated at compile time, look at the assembly generated using the -S GCC switch). with Ada.Text_IO; use Ada.Text_IO; procedure PT is X : constant := 1.0 + 2.0 ** (-1000); Y : constant := 1.0 + 2.0 ** (-1001); Z : constant := 2.0 ** (1001) * (X - Y); begin Put_Line (Float'Image (Z)); end PT; > I too would have expected a compile error rather than a compiler crash. I > will submit a bug report. Reasonable. Note that you should mention what compiler you are using together with its version and the OS (wether you're submitting a bug or posting here for help ;-). -- Laurent Guerby