comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Generic_Rational
Date: Sat, 17 Feb 2018 14:47:09 +0000
Date: 2018-02-17T14:47:09+00:00	[thread overview]
Message-ID: <lyh8qfhdw2.fsf@pushface.org> (raw)
In-Reply-To: e8943163-fdca-4c91-b388-fe561e3945e6@googlegroups.com

hnptz@yahoo.de writes:

> Thanks, it's working now. Nevertheless a further question:
>
> Simon wrote
>
> "... When the test program says 
>
>    for Candidate in 2..2**15 loop 
>
> Candidate is of type Integer (see ARM 3.6(17..18)[1], so that when it 
> says ... "
>
> Does a loop from 2..2**15 exceed the bounds of an integer type by one
> ? (see also 3.5.4(21)). If so, then Candidate should be become a
> Long_Integer type following 3.6(19). What may be wrong with this
> interpretation?

(18) says "If the type of the range resolves to root_integer, then the
discrete_subtype_definition defines a subtype of the predefined type
Integer with bounds given by a conversion to Integer of the bounds of
the range"; and I'm pretty sure that means "the largest integer type
suported by the implementation".

GNAT's Integer is -2**31 .. 2**31 -1 , so 2**15 is well
within. Long_Integer is -2**63 .. 2**63 - 1.

   for Candidate in 2..2**31 loop
        >>> value not in range of type "Standard.Integer"
        >>> static expression fails Constraint_Check

   for Candidate in 2..2**63 loop
        >>> warning: non-static universal integer value out of range
        >>> warning: "Constraint_Error" will be raised at run time
        >>> value not in range of type "Standard.Integer"
        >>> static expression fails Constraint_Check


  reply	other threads:[~2018-02-17 14:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-17 11:52 Generic_Rational hnptz
2018-02-17 12:33 ` Generic_Rational Simon Wright
2018-02-17 14:13 ` Generic_Rational hnptz
2018-02-17 14:47   ` Simon Wright [this message]
2018-02-17 16:41   ` Generic_Rational Jeffrey R. Carter
replies disabled

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