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,edfa88b682578b7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-25 00:15:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.cs.utexas.edu!geraldo.cc.utexas.edu!not-for-mail From: "Bobby D. Bryant" Newsgroups: comp.lang.ada Subject: Re: Overhead for type conversions? Date: Fri, 25 Jul 2003 01:12:41 -0600 Organization: dis- Message-ID: References: <3F209795.10303@attbi.com> NNTP-Posting-Host: dial-64-1.ots.utexas.edu Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: geraldo.cc.utexas.edu 1059117208 4487 128.83.253.97 (25 Jul 2003 07:13:28 GMT) X-Complaints-To: abuse@utexas.edu NNTP-Posting-Date: Fri, 25 Jul 2003 07:13:28 +0000 (UTC) User-Agent: Pan/0.14.0 (I'm Being Nibbled to Death by Cats!) Xref: archiver1.google.com comp.lang.ada:40796 Date: 2003-07-25T01:12:41-06:00 List-Id: On Fri, 25 Jul 2003 02:36:08 +0000, Robert I. Eachus wrote: > 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. There's not really any possibility of error, since any fp value is potentially legitimate for either type. In fact I have traditionally gotten by with simply using float for both kinds of variable; I was just thinking about separating the types for logical clarity and to make some composite structures based on the two types incompatible. Also I would like to get away from using float directly so I'll have a single point of change if I decide to start using long floats later on. The only reason I'm asking about type conversion overhead in this case is because my application already does many billions of multiplications over the course of a run, and within a few years that number might rise to trillions; and since I can live with float for both types I don't want to saddle the application with a lot of avoidable overhead. Thanks, -- Bobby Bryant Austin, Texas