From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b3e361752e757bb8,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.72.73 with SMTP id b9mr5513308pav.9.1350544292476; Thu, 18 Oct 2012 00:11:32 -0700 (PDT) Received: by 10.68.223.98 with SMTP id qt2mr4095632pbc.20.1350544292418; Thu, 18 Oct 2012 00:11:32 -0700 (PDT) Path: s9ni11397pbb.0!nntp.google.com!kt20no3033555pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 18 Oct 2012 00:11:32 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=123.160.229.140; posting-account=4uMkDwoAAACMyNluw6CdeU7BMSgYHFMk NNTP-Posting-Host: 123.160.229.140 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <422cd822-6d9a-4909-9009-995d845180b8@googlegroups.com> Subject: Fixed Point number mul, is it a bug? From: kylix Injection-Date: Thu, 18 Oct 2012 07:11:32 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-10-18T00:11:32-07:00 List-Id: -- GNAT GPL 2012 with Ada.Text_IO; procedure FixPoint is type FP is delta 0.01 range 0.00 .. 99.99; -- type FP is delta 0.01 digits 4; x : FP := 0.01; begin for i in 1 .. 5 loop x := x * 2; Ada.Text_IO.Put_Line("x =>" & FP'Image(x)); end loop; end Fixpoint; In my machine, it yield results: x => 0.02 x => 0.03 x => 0.06 x => 0.13 x => 0.25 Why not: 0.02 0.04 0.08 0.16 0.32 ? If FP declared as "type FP is delta 0.01 digits 4", it yield expected results.