* WG: Static vs dynamic evaluation anomaly?
@ 2007-02-07 6:38 Grein, Christoph (Fa. ESG)
0 siblings, 0 replies; only message in thread
From: Grein, Christoph (Fa. ESG) @ 2007-02-07 6:38 UTC (permalink / raw)
To: comp.lang.ada
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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-07 6:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 6:38 WG: Static vs dynamic evaluation anomaly? Grein, Christoph (Fa. ESG)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox