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-03 15:06:33 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dewar@gnat.com (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: How to catch NaNs with gnat3.14p Date: 3 Feb 2002 15:06:32 -0800 Organization: http://groups.google.com/ Message-ID: <5ee5b646.0202031506.3b21fba2@posting.google.com> References: <5ee5b646.0202011222.e4cd3cf@posting.google.com> <3C5D2D77.288208B0@earthlink.net> NNTP-Posting-Host: 205.232.38.244 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1012777593 7216 127.0.0.1 (3 Feb 2002 23:06:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 3 Feb 2002 23:06:33 GMT Xref: archiver1.google.com comp.lang.ada:19570 Date: 2002-02-03T23:06:33+00:00 List-Id: "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. > Of course in practical > implementations Float would have an upper bound, Yes, but this upper bound has nothing to do with 'Last in this case, see below. > but the notion of an unconstrained type having an upper > bound seems awkward. Indeed and there is no such notion in Ada 95, the whole point of an unconstrained scalar base type is that it does NOT have an upper bound from a semantic point of view. However they do have a base range which has an upper bound, but this upper bound is not the maximum possible stored value. The base range is defined as follows 6 The base range of a scalar type is the range of finite values of the type that can be represented in every unconstrained object of the type; it is also the range supported at a minimum for intermediate values during the evaluation of expressions involving predefined operators of the type. Seems clear enough, and note that is quite different from an upper bound, objects of the unconstrained base type can (and often do, e.g. extra precision in fpt registers) have results outside this base range and that's fine. So yes it would be peculiar to have an upper bound for an unconstrained type, and the *whole point* is that these types do NOT have an upper bound, but it is still useful to have a notion of guaranteed base range that is accomodated by *all* objects of the unconstrained base type. So in practice for example, the 'Last of Float is the upper limit of 32-bit IEEE for a float object stored in memory, but on the ia32, you might well use an 80-bit extended float value in a register to represent a Float object, and that would have a much much larger range. Robert Dewar