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.66.141.11 with SMTP id rk11mr19500619pab.26.1435584492457; Mon, 29 Jun 2015 06:28:12 -0700 (PDT) X-Received: by 10.182.91.81 with SMTP id cc17mr15525obb.21.1435584492389; Mon, 29 Jun 2015 06:28:12 -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!j8no1669514igd.0!news-out.google.com!t2ni505igk.0!nntp.google.com!j8no1669513igd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 29 Jun 2015 06:28:12 -0700 (PDT) In-Reply-To: <876168sx28.fsf@theworld.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=74.203.194.21; posting-account=bXcJoAoAAAAWI5APBG37o4XwnD4kTuQQ NNTP-Posting-Host: 74.203.194.21 References: <249bcd57-3074-4566-b8f2-03e6923bfbce@googlegroups.com> <6a104bde-67ea-48a5-a035-6be3f9235d42@googlegroups.com> <21e4185b-bc89-4940-b329-09863ad17344@googlegroups.com> <0320a865-5636-4ac6-81f7-ea56b761ce0d@googlegroups.com> <87a8vlrm9j.fsf@theworld.com> <876168sx28.fsf@theworld.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Fixed-point question From: Patrick Noffke Injection-Date: Mon, 29 Jun 2015 13:28:12 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:26536 Date: 2015-06-29T06:28:12-07:00 List-Id: On Saturday, June 27, 2015 at 3:42:11 PM UTC-5, Bob Duff wrote: > > For C2, the compiler is looking for a visible "/" that yields a result = of > > Fixed_Type, and only Fixed_Type's "/" does that. >=20 > Well, fixed-point division is kind of magical. The individual > fixed-point types don't have a "/" that takes parameters of the type and > returns the same type, but there's a "/" on universal_fixed that can be > used on any fixed-point types, and the two operands and result can all > be of different fixed-point types. See 4.5.5(18). Similar for "*". > There are also mixed fixed-integer ops for each fixed-point type. >=20 > There's a rule somewhere that says the context has to provide > the type of the result, so the compiler knows how much precision > is needed. E.g. you can say "X :=3D Y * Z;" but not > "X :=3D Y * Z * W;". >=20 But for C2 why is the compiler implicitly converting N and D to universal_f= ixed before doing the division? Isn't it just as valid to treat the consta= nts as universal_real and use the root_real "/" operator first and then do = the conversion? I don't see this discussed in 8.6 (29). There must be ano= ther rule for type conversion taking preference over division. Thanks, Patrick