From: "frikk" <frikker@gmail.com>
Subject: Re: Unsigned Integer Restraint Errors
Date: 12 Mar 2007 12:13:26 -0700
Date: 2007-03-12T12:13:26-07:00 [thread overview]
Message-ID: <1173726806.656979.305660@8g2000cwh.googlegroups.com> (raw)
In-Reply-To: <e9in1ny6b3gb.16e7shcfhyja8$.dlg@40tude.net>
> The semantics you probably have implied is:
>
> test : UNSIGNED_LONG_INT := UNSIGNED_LONG_INT (Integer'(-5));
>
> i.e. make *integer* -5 and convert it to test. This would indeed cause an
> error, as expected.
>
> > package LONG_IO is new Modular_IO(UNSIGNED_LONG_INT);
> > use LONG_IO;
>
> > begin
> > Put("Minimum Value(uint64_t): ");
> > Put(UNSIGNED_LONG_INT'FIRST);
> > New_Line;
> > Put("Maximum Value(uint64_t): ");
> > Put(UNSIGNED_LONG_INT'LAST);
> > New_Line;
>
> > test := -5;
>
> This shall not raise Constraint_Error. The result should be 2**64 - 5, see
> RM 4.5.4.
>
> It seems that Windows GCC 3.4.6 for GNAT GPL 2006 (20060522) has a bug here
> for 2**64 modulus. With lesser modulus it works correct.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de
Thank you for the input. This leaves me with 2 questions:
1. If my input is 2**35, wouldn't this still render the Integer type
inaccurate? The goal is to be able to use 64 bit integers... I'm
referring to your example of UNSIGNED_LONG_INT := UNSIGNED_LONG_INT
(Integer'(X));
2. If this is a bug, then what kind of maximum input should I ask for
as a work around? I can try this on my mac when I get home...
Thanks
Blaine
next prev parent reply other threads:[~2007-03-12 19:13 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
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 [this message]
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