comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: Naturals and discrete types
Date: Fri, 02 Nov 2001 17:24:40 GMT
Date: 2001-11-02T17:24:40+00:00	[thread overview]
Message-ID: <sFAE7.10257$xS6.14219@www.newsranger.com> (raw)
In-Reply-To: oGjE7.221593$K6.106487221@news2

In article <oGjE7.221593$K6.106487221@news2>, Clueless says...
>Also, I've been checking my Ada docs to find out if the Natural type is
>considered to be a Discrete or Real type by the GNAT compiler, but I
>havent found any specific info yet. Although the compiler messages
>certainly seem to indicate that Natural is a subtype of Real.

Boy are you confused!

Natural is a subtype of Integer with a range of 0 to Integer'last. It is defined
in package Standard (see
http://www.ada-auth.org/~acats/arm-html/RM-A-1.html#I4539 ). Thus you do *not*
need a conversion to use Natural where Integer is usable. However, you *do* need
a conversion ( "Float(My_Natural)" ) to use it where a Float is expected. There
is no type named "Real" (unless you count the one in Interfaces.Fortran), but
there are a class of types called "real", which includes floating-point and
fixed point types. The only predefined floating-point types is "Float" (and
"Long_Float" on some systems), and the only predefined fixed-point type is
"Duration".

This is all pretty basic stuff. If it is confusing you, you probably ought to go
read a good Ada book. If you don't want to shell out cash for one, there's one
online at http://www.it.bton.ac.uk/staff/je/adacraft/ . At least read through
chapter 5 there (http://www.it.bton.ac.uk/staff/je/adacraft/ch05.htm)

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html

No trees were killed in the sending of this message. 
However a large number of electrons were terribly inconvenienced.



  parent reply	other threads:[~2001-11-02 17:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-01 22:05 Naturals and discrete types Clueless
2001-11-01 22:35 ` Matthew Heaney
2001-11-01 22:59 ` Clueless
2001-11-02 15:05   ` Marin David Condic
2001-11-02 17:24 ` Ted Dennison [this message]
2001-11-02 18:19   ` Preben Randhol
2001-11-02 18:51     ` Marin David Condic
2001-11-03 18:01       ` Nick Roberts
2001-11-04  4:18         ` tmoran
2001-11-05 15:29           ` Marin David Condic
2001-11-04 11:39       ` Preben Randhol
2001-11-05  2:01         ` Clueless
2001-11-05  2:37           ` Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
2001-11-01 23:06 Beard, Frank
2001-11-01 23:20 ` Clueless
2001-11-02  3:05   ` DuckE
replies disabled

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