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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b2923d60cb81694b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!8g2000cwh.googlegroups.com!not-for-mail From: "frikk" Newsgroups: comp.lang.ada Subject: Re: Unsigned Integer Restraint Errors Date: 12 Mar 2007 12:13:26 -0700 Organization: http://groups.google.com Message-ID: <1173726806.656979.305660@8g2000cwh.googlegroups.com> References: <1173712032.183064.264340@8g2000cwh.googlegroups.com> NNTP-Posting-Host: 12.129.98.129 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1173726848 11323 127.0.0.1 (12 Mar 2007 19:14:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 12 Mar 2007 19:14:08 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 TRY0PX01 Complaints-To: groups-abuse@google.com Injection-Info: 8g2000cwh.googlegroups.com; posting-host=12.129.98.129; posting-account=192wHg0AAAAzciSzoZsEBI9bw5pVCopO Xref: g2news1.google.com comp.lang.ada:14490 Date: 2007-03-12T12:13:26-07:00 List-Id: > 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