comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: RFC:  Generic Fixed-Point IIR Filter
Date: Thu, 26 Mar 2015 15:02:18 -0700
Date: 2015-03-26T15:02:18-07:00	[thread overview]
Message-ID: <mf1vjn$23k$1@dont-email.me> (raw)
In-Reply-To: <mf1snt$3j6$1@loke.gir.dk>

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

  parent reply	other threads:[~2015-03-26 22:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26 16:25 RFC: Generic Fixed-Point IIR Filter Patrick Noffke
2015-03-26 17:05 ` Dmitry A. Kazakov
2015-03-26 17:41 ` Jeffrey Carter
2015-03-26 19:44   ` Patrick Noffke
2015-03-26 20:34     ` Randy Brukardt
2015-03-26 20:39       ` Jeffrey Carter
2015-03-26 21:12         ` Randy Brukardt
2015-03-26 21:30           ` Patrick Noffke
2015-03-26 22:02           ` Jeffrey Carter [this message]
2015-03-27 12:17           ` G.B.
2015-03-26 21:17       ` Patrick Noffke
2015-03-26 20:37     ` Jeffrey Carter
2015-03-27 11:37 ` Brian Drummond
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox