comp.lang.ada
 help / color / mirror / Atom feed
From: Eric Jacoboni <jaco@neottia.net>
Subject: Re: The right way to handle this difference in Ada
Date: Thu, 22 Jul 2004 15:22:24 +0200
Date: 2004-07-22T15:22:24+02:00	[thread overview]
Message-ID: <m2smbkch2n.fsf@mac.scrogneugneu.org> (raw)
In-Reply-To: 15yc7cceofj1e$.ioaad0q1si6i.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:


> 2. Well, if c should be negative then probably:
>
>    type int_12_type is range -2**12..2**12-1;
>    subtype unsigned_int_12_subtype is
>       int_12_type range 0..int_12_type'Last;
>
>    a : unsigned_int_12_subtype := 1;
>    b : unsigned_int_12_subtype := 2;
>    c : int_12_type := a - b; -- yields -1

Perhaps i've not understood all the implications of the initial
question but, imo, a signed int_n_type varies from -2**(n - 1) to
+2**(n - 1) - 1, not from -2**n to +2**n - 1.

-- 
�ric Jacoboni, n� il y a 1393946375 secondes



  reply	other threads:[~2004-07-22 13:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-22 10:23 The right way to handle this difference in Ada vic
2004-07-22 11:53 ` Eric Jacoboni
2004-07-22 12:07 ` Nick Roberts
2004-07-22 13:03 ` Dmitry A. Kazakov
2004-07-22 13:22   ` Eric Jacoboni [this message]
2004-07-22 13:34     ` Dmitry A. Kazakov
2004-07-22 13:34 ` Björn Persson
2004-07-22 17:52 ` Georg Bauhaus
2004-07-22 18:10   ` Georg Bauhaus
2004-07-23  3:41 ` Steve
2004-07-23 12:47   ` Marius Amado Alves
2004-07-24  3:14     ` Robert I. Eachus
replies disabled

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