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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.46.227 with SMTP id y3mr9018783obm.7.1435427973170; Sat, 27 Jun 2015 10:59:33 -0700 (PDT) X-Received: by 10.182.50.136 with SMTP id c8mr48048obo.10.1435427973119; Sat, 27 Jun 2015 10:59:33 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!j8no719413igd.0!news-out.google.com!kd3ni19335igb.0!nntp.google.com!j8no526582igd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 27 Jun 2015 10:59:32 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.209.165.119; posting-account=bXcJoAoAAAAWI5APBG37o4XwnD4kTuQQ NNTP-Posting-Host: 24.209.165.119 References: <249bcd57-3074-4566-b8f2-03e6923bfbce@googlegroups.com> <6a104bde-67ea-48a5-a035-6be3f9235d42@googlegroups.com> <21e4185b-bc89-4940-b329-09863ad17344@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0320a865-5636-4ac6-81f7-ea56b761ce0d@googlegroups.com> Subject: Re: Fixed-point question From: Patrick Noffke Injection-Date: Sat, 27 Jun 2015 17:59:33 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:26496 Date: 2015-06-27T10:59:32-07:00 List-Id: On Friday, June 26, 2015 at 11:44:07 PM UTC-5, Jeffrey R. Carter wrote: > On 06/26/2015 08:00 PM, Patrick Noffke wrote: > > On Friday, June 26, 2015 at 6:13:11 PM UTC-5, qunying wrote: > >> In my test with Linux x86_64 with FSF GNAT 4.9.2 > >> > >> C1 := 14.664 > >> C2 := 17.000 > >> Small := 3.90625000000000000E-03 > >> 1/180 := 5.55555555555555556E-03 > >> > >> With Jeffrey's changes I got: > >> C1 := 14.667 > >> C2 := 18.000 > >> Small := 5.55555555555555556E-03 > >> 1/180 := 5.55555555555555556E-03 > >> > > > > So is this a bug, is the ARM not clear on what should happen here, or is it expected? > > With a small of 1/180: > > For C1, AFAICT, the compiler will calculate N/D exactly, getting 44/3 = > 14.6666...., and then convert this to Fixed_type, getting 2640/180. > > For C2, "/" for Fixed_Type is used, so N and D are converted to Fixed_Type > first. My question is whether this is the right thing for the compiler to do. Pat