From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Fixed Point number mul, is it a bug?
Date: Thu, 18 Oct 2012 07:04:22 -0700 (PDT)
Date: 2012-10-18T07:04:22-07:00 [thread overview]
Message-ID: <a3b178fb-d1c2-4d88-80be-f0eb5918915c@googlegroups.com> (raw)
In-Reply-To: <422cd822-6d9a-4909-9009-995d845180b8@googlegroups.com>
Try:
Package FP is
Type Fixed is delta 0.01 range 0.00 .. 99.99;
Private
For Fixed'Small use 0.01;
End FP;
Then:
Declare
use type FP.Fixed;
X : FP.Fixed:= 0.01;
Begin
For index in 1..5 loop
x := x * 2;
Ada.Text_IO.Put_Line( "x =>" & X'Img );
end loop;
End;
Yields:
x => 0.02
x => 0.04
x => 0.08
x => 0.16
x => 0.32
(I'm using GNAT on a Windows/AMD.)
prev parent reply other threads:[~2012-10-18 14:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-18 7:11 Fixed Point number mul, is it a bug? kylix
2012-10-18 7:35 ` Vinzent Höfler
2012-10-18 14:49 ` Adam Beneschan
2012-10-19 9:09 ` AdaMagica
2012-10-18 7:57 ` Dmitry A. Kazakov
2012-10-18 10:34 ` Georg Bauhaus
2012-10-18 10:42 ` Ian Clifton
2012-10-18 12:37 ` Dmitry A. Kazakov
2012-10-19 22:58 ` Ian Clifton
2012-10-18 14:40 ` Adam Beneschan
2012-10-18 14:04 ` Shark8 [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox