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=0.6 required=5.0 tests=BAYES_00,LOTS_OF_MONEY, TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,58e0097f787e49d4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-02 09:25:22 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator-SanJose!in.nntp.be!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: Subject: Re: Naturals and discrete types Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Fri, 02 Nov 2001 12:24:40 EST Organization: http://www.newsranger.com Date: Fri, 02 Nov 2001 17:24:40 GMT Xref: archiver1.google.com comp.lang.ada:15676 Date: 2001-11-02T17:24:40+00:00 List-Id: In article , 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.