comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.de>
Subject: Re: Unsigned Integer Restraint Errors
Date: Mon, 12 Mar 2007 17:27:04 +0100
Date: 2007-03-12T17:23:39+01:00	[thread overview]
Message-ID: <1173716824.8455.17.camel@localhost> (raw)
In-Reply-To: <1173712032.183064.264340@8g2000cwh.googlegroups.com>

On Mon, 2007-03-12 at 08:07 -0700, frikk wrote:
> Hello Everyone!
> 
> I'm having a trivial difficulty with Ada. I am working with a 64 bit
> unsigned integer, and of course I would like to know if the input to
> this unsigned integer is out of range. I am having two issues.  The
> first is that I cannot get ada to raise a constraint error unless I
> make a subtype and state the range of being a finite number (but only
> in some circumstances, I'll explain in a second). 
> 
> procedure Prime_Bits is
>    -- Declare a 64 bit unsigned integer
>    type UNSIGNED_LONG_INT is mod 2**64;

> 
>    test := -5;

This first question is probably answered by LRM 3.4.5,
 19. For a modular type, if the result of the execution of a predefined
     operator is outside the base range of the type, the
     result is reduced modulo the modulus of the type to a value that
     is within the base range of the type.

HTH





  reply	other threads:[~2007-03-12 16:27 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-12 15:07 Unsigned Integer Restraint Errors frikk
2007-03-12 16:27 ` Georg Bauhaus [this message]
2007-03-12 17:17 ` Adam Beneschan
2007-03-12 17:23 ` Adam Beneschan
2007-03-12 18:11   ` frikk
2007-03-12 20:00     ` frikk
2007-03-12 20:07       ` Adam Beneschan
2007-03-12 18:00 ` Dmitry A. Kazakov
2007-03-12 19:00   ` Martin Krischik
2007-03-12 21:13     ` Dmitry A. Kazakov
2007-03-12 19:13   ` frikk
2007-03-12 19:22     ` Randy Brukardt
2007-03-13  3:13       ` Jeffrey R. Carter
2007-03-13  3:00         ` Randy Brukardt
2007-03-13 12:09           ` frikk
2007-03-13 14:58             ` frikk
2007-03-13 15:31               ` frikk
2007-03-13 15:59                 ` Robert A Duff
2007-03-13 16:18                 ` Dmitry A. Kazakov
2007-03-13 16:21                 ` Jeffrey R. Carter
2007-03-13 16:04               ` Adam Beneschan
2007-03-13 16:41                 ` Adam Beneschan
2007-03-13 16:42                   ` Adam Beneschan
2007-03-14 14:06                     ` frikk
2007-03-13 17:23                 ` Dmitry A. Kazakov
2007-03-13 17:31                   ` Adam Beneschan
2007-03-14  0:54                   ` Jeffrey R. Carter
2007-03-16 13:38                   ` frikk
2007-03-13 16:16           ` Jeffrey R. Carter
2007-03-12 21:04     ` Dmitry A. Kazakov
replies disabled

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