comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Simple loop with a strange output
Date: Thu, 23 May 2013 07:41:24 -0700 (PDT)
Date: 2013-05-23T07:41:24-07:00	[thread overview]
Message-ID: <9d131b52-1fe8-4fcb-bb99-c034cefadeee@googlegroups.com> (raw)
In-Reply-To: <96af9cd4-3368-4866-a38e-2514a0a7a54d@googlegroups.com>

On Thursday, May 23, 2013 7:37:24 AM UTC-7, Adam Beneschan wrote:
> On Thursday, May 23, 2013 6:53:19 AM UTC-7, Luca Cappelletti wrote:
 
> > do you know what's happening?
 
> Overflow.
> 
> The largest possible value of an "integer" type on this platform is (2**31)-1.  So when X hits 2**30 and then you double it, the actual value, 2**31, won't fit in an integer.  If you use the right flags when compiling (I don't remember what they are), 

OK, if you compile with -gnato, it will do the check, and now the program will die on a Constraint_Error instead of getting into an infinite loop.

                            -- Adam



  reply	other threads:[~2013-05-23 14:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 13:53 Simple loop with a strange output Luca Cappelletti
2013-05-23 13:55 ` Luca Cappelletti
2013-05-23 14:37 ` Adam Beneschan
2013-05-23 14:41   ` Adam Beneschan [this message]
2013-05-23 16:09     ` Luca Cappelletti
2013-05-23 16:40       ` Simon Wright
2013-05-23 21:34         ` Randy Brukardt
2013-05-24  7:21           ` Simon Wright
2013-05-24 12:46           ` Britt
2013-05-23 20:41 ` Dirk Heinrichs
replies disabled

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