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!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: RFC: Generic Fixed-Point IIR Filter Date: Thu, 26 Mar 2015 15:02:18 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <2c2ee86e-b9bd-49e3-aa7f-206f3c4da95e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Thu, 26 Mar 2015 22:01:29 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="3f77efd256cd7097938236a53a6861ee"; logging-data="2164"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PPIm868smrhEHd0DqLIeNhY8t5UwIejE=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: Cancel-Lock: sha1:j9VeX707Ujkxqu6zNTwUzZ1Bxh8= Xref: news.eternal-september.org comp.lang.ada:25277 Date: 2015-03-26T15:02:18-07:00 List-Id: On 03/26/2015 02:12 PM, Randy Brukardt wrote: > > 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). That makes sense. The main reason for fixed point in Ada 83 was to be faster than SW floating-point on processors without FPUs. But since, as you note, the compiler has to be able to do unbounded-precision math, then the compiler could link in the library it uses to do that and do its intermediate calculations using it. There could be a compiler switch to determine which is done. I think GNAT has this. What would be even better would be for the language to make the spec of that unbounded-precision package part of the standard library. -- Jeff Carter "Since I strongly believe that overpopulation is by far the greatest problem in the world, this [Soylent Green] would be my only message movie." Charleton Heston 123