Re: [linux-audio-dev] Fixed vs. floating point

From: fons adriaensen <fons.adriaensen@email-addr-hidden>
Date: Mon Oct 17 2005 - 22:58:06 EEST

On Mon, Oct 17, 2005 at 02:18:52PM -0400, Paul Davis wrote:

> > > Here's some papers specifically geared toward DSP processors that
> > > support the use of fixed point:
> > >
> > > Superior Audio Requires Fixed-Point DSP
> > > http://www.rane.com/note153.html
>
> what a lame author!

I'd agree, but he has some valid points. Using floats may give you
the impression that you don't have to care much about how a particular
algo works, and that is a trap many a DSP programmer has fallen into.
Problems arise when an algorithm systematically subtracts near equal
quantities and presents the difference as a valid result, and this
does indeed occur easily with low frequency filters. But AFAICS,
it's nearly always possible to work around this if you understand
the algorithm. The problem occurs mostly when textbook algorithms
are implemented literally, and is not confined to audio or DSP.

A classic example is the solution of a quadratic equation:

  a * x * x + b * x + c = 0

The textbook solution is:

  d = sqrt (b * b - 4 * a * c)
  x1 = (-b + d) / (2 * a)
  x2 = (-b - d) / (2 * a)

When the magnitudes of d and b are nearly equal (and that
occurs systematically in some applications), one of the
two results can be very imprecise. (*)

To return to the quoted text, I have the impression that
the author compares badly implemented float routines with
correctly written fixed points ones. It's easy to arrive
at a predefined conclusion that way.

-- 
FA
(*) The solution is to compute the largest magnitude root
    first, and then obtain the second one from their
    product, c / a.
 
Received on Tue Oct 18 00:15:10 2005

This archive was generated by hypermail 2.1.8 : Tue Oct 18 2005 - 00:15:10 EEST