Boost logo

Boost :

Subject: Re: [boost] Fixed point integer proposal
From: Soren Holstebroe (holstebroe_at_[hidden])
Date: 2009-06-25 22:07:18


> In this (slightly-less non-toy case), floats were a little bit faster. If
> you actually used fixed-point here, rather than floats, then the difference
> would be much larger again.

You are indeed right, that enabling SSE2 gives float speed close to
integer speed.
I tested your code example and depending on which operations that were
used in the calculation I got different winner types (i changed the
mod operator in your array access, since that was very expensive and
biased the results).
I also tested my fixed point template and interestingly it performed
best of the three for some calculations. I was surprised about that
one and have no good explanation to that yet. I might have to look
into the generated assembly code to check out what is going on.

Anyway, as you point out, speed isn't the only justification for a
fixed point class, if at all, though you might get considerable speed
gains on some architectures.

I have enjoyed the seamless syntax of converting third party fixed
point audio stream (libmad) to floats for audio filtering and then to
the sound system output. Since I defined my float audio to be in
normal range between -1 and 1 I just had to define a 16 bit signed
fixed point for the audio output type.

Driftless accumulation is another obvious benefit of fixed point in
many applications.

All in all I still believe a fixed point class would fit in the boost
library, since it has many general applications.

Regards
Soren


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk