From: austin.obyrne769@btinternet.com
Subject: Re: Integer Overflow Question.
Date: Mon, 25 Aug 2014 06:29:06 -0700 (PDT)
Date: 2014-08-25T06:29:06-07:00 [thread overview]
Message-ID: <72292a00-d668-4000-94c3-172094ec8dd1@googlegroups.com> (raw)
In-Reply-To: <ltfcif$ahg$1@dont-email.me>
On Monday, August 25, 2014 2:09:35 PM UTC+1, Simon Clubley wrote:
> 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
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
next prev parent reply other threads:[~2014-08-25 13:29 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
2014-08-25 13:29 ` austin.obyrne769 [this message]
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