comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcqada95@earthlink.net>
Subject: Re: How to catch NaNs with gnat3.14p
Date: Mon, 04 Feb 2002 13:05:58 GMT
Date: 2002-02-04T13:05:58+00:00	[thread overview]
Message-ID: <3C5E79EB.72BE43D5@earthlink.net> (raw)
In-Reply-To: 5ee5b646.0202031506.3b21fba2@posting.google.com

Robert Dewar wrote:
> 
> "Marc A. Criley" <mcqada95@earthlink.net> 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



  reply	other threads:[~2002-02-04 13:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-01 13:49 How to catch NaNs with gnat3.14p Alexander Boucke
2002-02-01 14:18 ` Preben Randhol
2002-02-01 14:37   ` Alexander Boucke
2002-02-01 14:55     ` Preben Randhol
2002-02-01 14:59       ` Alexander Boucke
2002-02-01 15:30         ` Preben Randhol
2002-02-01 16:10           ` Alexander Boucke
2002-02-01 16:10             ` Jeffrey Creem
2002-02-02  6:23               ` Robert Dewar
2002-02-02  6:21     ` Robert Dewar
2002-02-04  8:57       ` Alexander Boucke
2002-02-02  6:20   ` Robert Dewar
2002-02-02 12:49     ` Preben Randhol
2002-02-02 22:56       ` Robert Dewar
2002-02-01 20:22 ` Robert Dewar
2002-02-03 13:27   ` Marc A. Criley
2002-02-03 23:06     ` Robert Dewar
2002-02-04 13:05       ` Marc A. Criley [this message]
2002-02-05  1:06         ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox