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,CP1252 X-Google-Thread: 103376,edfa88b682578b7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-24 19:36:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp-server.caltech.edu!attla2!ip.att.net!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc52.ops.asp.att.net.POSTED!not-for-mail Message-ID: <3F209795.10303@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Overhead for type conversions? References: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 66.31.71.243 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc52.ops.asp.att.net 1059100567 66.31.71.243 (Fri, 25 Jul 2003 02:36:07 GMT) NNTP-Posting-Date: Fri, 25 Jul 2003 02:36:07 GMT Organization: Comcast Online Date: Fri, 25 Jul 2003 02:36:08 GMT Xref: archiver1.google.com comp.lang.ada:40789 Date: 2003-07-25T02:36:08+00:00 List-Id: Bobby D. Bryant wrote: > and given that run-time range checks are enabled, should I expect my > compiler to execute range checking code for each f1*f2 multiplication, > or will the compiler conclude from the definitions that the two types > are always convertible without error regardless of the specific value, > and thus not generate any code for a range check? > > (In practice the compiler is GNAT.) GNAT chooses IEEE representation for Float with non-signalling NaNs. In other words there are operation which will generate +infinity or -infinity but no constraint checks. Of course this means that if you really want to force a Constraint_Error you have to assign a Float to a variable with a constraint. To reference a huge amount of sound and fury going on right now, something like: BH := Short_Integer(Some_Float_Value); will do just fine. (But then you have to decide how the exception should be handled. ;-) -- Robert I. Eachus �In an ally, considerations of house, clan, planet, race are insignificant beside two prime questions, which are: 1. Can he shoot? 2. Will he aim at your enemy?� -- from the Laiden novels by Sharon Lee and Steve Miller.