comp.lang.ada
 help / color / mirror / Atom feed
From: austin.obyrne769@btinternet.com
Subject: Re: Integer Overflow Question.
Date: Mon, 25 Aug 2014 12:38:16 -0700 (PDT)
Date: 2014-08-25T12:38:16-07:00	[thread overview]
Message-ID: <e434f7cd-4c33-43d0-9f0c-c85d9ca3db91@googlegroups.com> (raw)
In-Reply-To: <lysikkiixk.fsf@pushface.org>

On Monday, August 25, 2014 6:21:43 PM UTC+1, Simon Wright wrote:
> austin.obyrne769@btinternet.com writes:
> 
> 
> 
> > Could you please set out the Ada-95 sourcecode for defining an integer
> 
> > variable called "CipherText" in the range say of 8 decimal digits to
> 
> > 12 decimal digits. I can do the others myself once I know what to do.
> 
> 
> 
> This may help:
> 
> 
> 
> with Ada.Text_IO;
> 
> procedure Obyrne is
> 
>    type Ciphertext_Integer is range -10 ** 12 .. 10 ** 12;
> 
> begin
> 
>    Ada.Text_IO.Put_Line
> 
>      ("first is " & Ciphertext_Integer'Image (Ciphertext_Integer'First)
> 
>         & ", last is " & Ciphertext_Integer'Image (Ciphertext_Integer'Last));
> 
> end Obyrne;
> 
> 
> 
> With up-to-date GNAT, this outputs
> 
> 
> 
> first is -1000000000000, last is  1000000000000

One last question that may have been taken for granted by the various people who helped me re-define integers.

If I define integers in a range that is outside of 2^31 - 1 (2147483647) will it be possible to use these in a 32-bit computer or is the advice and methodology re user defined integers given to me earlier related to 64-bit environment only - I forgot to ask.  This is important because I must cater for both sizes of home owners' computers.

If defining integers larger than the scope of the 32-bit computer means using 64-bit as an inevitable consequence then I cannot do it.

Would some body comment on this please.

Sorry to be such a nuisance.


adacrypt

  parent reply	other threads:[~2014-08-25 19:38 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
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 [this message]
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