Subject: Re: [boost] Fixed point integer proposal
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2009-06-25 15:19:59
Soren Holstebroe wrote:
> In my template N bit x N bit equals N bit per default.
Which of the 2N possible bits do you keep, and which do you discard?
I chose to try to behave as closely as possible to how built-in integer
types work. If I multiply uint8_t * uint8_t and assign the result to a
uint32_t, it works. IIUC the equivalent operation would not work with
your implementation, right?
> The number one design criteria was speed. Why would you use fixed
> point instead of floats if not for speed?
In my case, it has been for two reasons:
- To store in 32 bits a value with a precision of 2^-32, not the 2^-24
that you get with a float.
- To allow me to do Z-curve bit manipulations on the values.
Speed is also useful of course.
As I think you are already seeing from the other responses there are
various different applications for fixed point. Your choice is either
to try to get a subset of the possible functionality that does what you
want approved, or to invest some effort in expanding your library to
make everyone happy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk