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 X-Received: by 10.50.85.42 with SMTP id e10mr10237858igz.0.1408973346326; Mon, 25 Aug 2014 06:29:06 -0700 (PDT) X-Received: by 10.140.88.85 with SMTP id s79mr26599qgd.18.1408973346293; Mon, 25 Aug 2014 06:29:06 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!r2no6921419igi.0!news-out.google.com!j6ni8038qas.0!nntp.google.com!m5no2766243qaj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 25 Aug 2014 06:29:06 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=5.81.69.184; posting-account=j15vhwoAAABH_eywb4s2_dWxAM2kkx7W NNTP-Posting-Host: 5.81.69.184 References: <9c5de333-276c-4e3a-be5a-4e5a98cdaa1d@googlegroups.com> <440bf1f1-3e98-47ac-b0c0-f73f170a3603@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <72292a00-d668-4000-94c3-172094ec8dd1@googlegroups.com> Subject: Re: Integer Overflow Question. From: austin.obyrne769@btinternet.com Injection-Date: Mon, 25 Aug 2014 13:29:06 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:21903 Date: 2014-08-25T06:29:06-07:00 List-Id: On Monday, August 25, 2014 2:09:35 PM UTC+1, Simon Clubley wrote: > On 2014-08-25, austin.obyrne769@btinternet.com wrote: > > > On Monday, August 25, 2014 12:46:01 PM UTC+1, G.B. wrote: > > >> On 25.08.14 13:21, austin.obyrne769@btinternet.com wrote: > > >> > > >> > I have had to put a bound on the maximum integer size output of computations at 2^31 which of course is the maximum positive integer that 32-bit computers can handle. > > >> > > >> > > >> > > >> Would this not be 2^31 - 1? > > >> > > >> > > >> > > >> Also, how does your program respond when translated with -gnato? > > > > > >>Would this not be 2^31 - 1? - NO > > > > > > The max, POS integer is 2^(32-1) > > > > > > > Signed or unsigned integers ? > > > > > I understand the the max NEG integer is -[2^32-1)+1] > > > > > > > I think you understand incorrectly. The sign bit is a part of the > > 32 bit value so the range you can express is cut approx in half. > > > > Simon. > > > > -- > > Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP > > Microsoft: Bringing you 1980s technology to a 21st century world Thanks - I usually remember it in denary as, Max Pos. Int = 2147483647 Max Neg. Int = -2147483648 The important thing to me is in knowing what to put in my exception handler. Many thanks - Austin