From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: RFC: Generic Fixed-Point IIR Filter
Date: Thu, 26 Mar 2015 16:12:28 -0500
Date: 2015-03-26T16:12:28-05:00 [thread overview]
Message-ID: <mf1snt$3j6$1@loke.gir.dk> (raw)
In-Reply-To: mf1qo9$dqb$3@dont-email.me
"Jeffrey Carter" <spam.jrcarter.not@spam.not.acm.org> 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.
next prev parent reply other threads:[~2015-03-26 21:12 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 [this message]
2015-03-26 21:30 ` Patrick Noffke
2015-03-26 22:02 ` Jeffrey Carter
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