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,57d25404e12d2837 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-04 05:06:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!paloalto-snh1.gtei.net!lsanca1-snf1!news.gtei.net!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3C5E79EB.72BE43D5@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How to catch NaNs with gnat3.14p References: <5ee5b646.0202011222.e4cd3cf@posting.google.com> <3C5D2D77.288208B0@earthlink.net> <5ee5b646.0202031506.3b21fba2@posting.google.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 04 Feb 2002 13:05:58 GMT NNTP-Posting-Host: 63.178.185.116 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1012827958 63.178.185.116 (Mon, 04 Feb 2002 05:05:58 PST) NNTP-Posting-Date: Mon, 04 Feb 2002 05:05:58 PST X-Received-Date: Mon, 04 Feb 2002 05:05:59 PST (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:19585 Date: 2002-02-04T13:05:58+00:00 List-Id: Robert Dewar wrote: > > "Marc A. Criley" wrote in message news:<3C5D2D77.288208B0@earthlink.net>... > > Robert Dewar wrote: > > > > > > Remember that float and long_float are > > > unconstrained types in Ada 95. > > > > When I fully realized a few years ago that the predefined > > Float type, unlike Integer, is an unconstrained type, > > That's a bit misleading, the base range of all integer > types is also uncontrained (e.g. Integer'Base is unconstrained, and > you should routinely use Integer'Base > if you don't care about the extra range, since it can > generate more efficient code). Or, if you declare your > own type My_Int, then similarly use My_Int'Base. > > > > It.did make me wonder by what rationale Float'Last has a > > value, since 'Last "denotes the upper bound > > of the range of S" [3.5 (13)]. > > That's confusing. The whole point of these types is that they have a > base range, see below, but this base range does not constrain the > range of possible values. I certainly did not intend to be misleading or confusing, and I do appreciate the explanation of the detail of the concept behind base and unconstrained ranges. >From an Ada practitioners point-of-view, however, the fact that the predefined Integer is constrained, the predefined Float is unconstrained, and 'Last works on both seems odd. I encountered this when working on my ASIS_Expression_Resolver package a couple years ago. AER handles a number of the range-oriented attributes, so when implementing recognition and evaluation of 'Last, I invoke Integer_Constraint() on the Type_Definition corresponding to Integer on the way to getting its upper bound. Invoking Real_Range_Constraint() on the Float Type_Definition, however, gave me a Nil_Element (which it should, since Float is unconstrained). Unfortunately I was left then with no way to use ASIS to extract the value of Float'Last. The AER implementation ended up specifically watching for Float'Last and simply evaluating Float'Last internally for the result. Marc A. Criley Consultant Quadrus Corporation www.quadruscorp.com