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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: 64-bit unsigned integer? Date: Sun, 25 Feb 2018 13:41:58 +0100 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: b3/KWLDSh2Q785SrqKUcjA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:50633 Date: 2018-02-25T13:41:58+01:00 List-Id: On 2018-02-25 13:30, MM wrote: > I'm trying to get an unsigned integer type of 64 bits without modular wraparound. Unsigned integers and modular integers are same, mathematically at least, considering the semantics of arithmetic operations. What you want is a [signed] integer subtype of the range 0..2**64-1. > type u64 is range 0 .. 2**64-1; -- this fails with "integer type definition bounds out of range". This is the right method alas not supported by the architecture of the machine you have. > Is there a way to do it so can get an unsigned integer that will raise an exception if it overflows? You must implement it yourself, e.g. on top of a modular or integer type, or use an arbitrary length integer arithmetic package. There exist a few in Ada. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de