comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP>
Subject: Re: Integer Overflow Question.
Date: Mon, 25 Aug 2014 13:09:35 +0000 (UTC)
Date: 2014-08-25T13:09:35+00:00	[thread overview]
Message-ID: <ltfcif$ahg$1@dont-email.me> (raw)
In-Reply-To: 440bf1f1-3e98-47ac-b0c0-f73f170a3603@googlegroups.com

On 2014-08-25, austin.obyrne769@btinternet.com <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


  reply	other threads:[~2014-08-25 13:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 11:21 Integer Overflow Question austin.obyrne769
2014-08-25 11:46 ` G.B.
2014-08-25 12:58   ` austin.obyrne769
2014-08-25 13:09     ` Simon Clubley [this message]
2014-08-25 13:29       ` austin.obyrne769
2014-08-25 13:44         ` Simon Clubley
2014-08-25 13:34     ` Aay Jay Chan
2014-08-25 15:09       ` austin.obyrne769
2014-08-25 17:02       ` austin.obyrne769
2014-08-25 17:21         ` Simon Wright
2014-08-25 17:56           ` austin.obyrne769
2014-08-25 19:38           ` austin.obyrne769
2014-08-25 17:40         ` Simon Clubley
2014-08-25 18:09           ` austin.obyrne769
2014-08-25 12:20 ` gautier_niouzes
2014-08-25 12:54   ` austin.obyrne769
replies disabled

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