From: "Grein, Christoph (Fa. ESG)" <Christoph.Grein@eurocopter.com>
To: comp.lang.ada@ada-france.org
Subject: WG: Static vs dynamic evaluation anomaly?
Date: Wed, 07 Feb 2007 07:38:48 +0100
Date: 2007-02-07T07:40:01+01:00 [thread overview]
Message-ID: <mailman.77.1170830303.18371.comp.lang.ada@ada-france.org> (raw)
No, this program is absolute correct. Modular types do not overflow,
they use modular arithmetic.
with Ada.Text_IO;
use Ada.Text_IO;
procedure test271 is
type Six_Bits is mod 2**6;
X: constant Six_Bits := 31;
Z: constant Integer := 31;
begin
for J in 0..5 loop
Put_Line (Integer 'Image (J) &
Six_Bits'Image (X * 2**J) &
Integer 'Image ((X * 2**J) mod Six_Bit'Modulus));
end loop;
end test271;
reply other threads:[~2007-02-07 6:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox