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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: RFC: Generic Fixed-Point IIR Filter Date: Thu, 26 Mar 2015 16:12:28 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <2c2ee86e-b9bd-49e3-aa7f-206f3c4da95e@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1427404349 3686 24.196.82.226 (26 Mar 2015 21:12:29 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 26 Mar 2015 21:12:29 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:25274 Date: 2015-03-26T16:12:28-05:00 List-Id: "Jeffrey Carter" wrote in message news:mf1qo9$dqb$3@dont-email.me... > On 03/26/2015 01:34 PM, Randy Brukardt wrote: >> >> A result of universal-fixed always has to be converted immediately to >> another type. It's not legal to use it directly. Specifically, >> 4.5.5(19.1/2) >> says: "The above two fixed-fixed multiplying operators shall not be used >> in >> a context where the expected type for the result is itself >> universal_fixed >> ". > > So there's always an expected subtype? I thought in a string of operations > in an > expression, there was no expected type until the conversion of the result > to the > expected subtype of the entire expression. Right. The rule specifically does not allow something like: A * B * C because that could take an infinite number of bits to evaluate (just keeping adding the * operators) - the number of bits needed is the sum of the maximum bits for each value. Universal-fixed is not supposed to overflow, some something has to make it implementable. In addition, most machines have a double precision multiply operation (like the 32*32 bits gives 64 bits operation the OP mentioned and a matching divide). So there's an obvious implementation in many cases (not on the margins, as I noted), so long as we are talking about a single multiply. Ada runtime math isn't supposed to require some complex infinite precision operation (which admittedly is interesting, since the compiler is required to do exactly that). Randy.