Boost logo

Boost :

Subject: Re: [boost] [boostcon][proto] Suggestion for LIAW session: fixed-pointnumbers
From: Ravi (lists_ravi_at_[hidden])
Date: 2011-03-16 02:21:00


On Tuesday 15 March 2011 21:10:52 Gruenke, Matt wrote:
> > All of the others required non-obvious rules to represent the cases when
> > the MSB is to the right of the binary point or the LSB is much to the
> > left of the binary point.
>
> I'm not sure we're talking about the same thing, here. The template
> parameters of the results returned by my operators were determined by
> those of the operands.

In the system you proposed, what are the template parameters for the fixed-
point number with the following range?
  { 0, 1, ..., 15 } x 2^{-11}
Or, the fixed-point number holding values in the following range?
  { 0, 1, ..., 15 } x 2^{11}

> > > * inverse returns a type with one fewer frac bits than the
> > >
> > > operand had int bits and one more int bits than the
> > > operand had frac bits. This sacrifice of precision is
> > > necessary to avoid overflow.
> >
> > This one is tricky; the behavior you propose is completely unacceptable
> > for signal processing.
>
> Which one? Inverse? If you need more headroom, you can always add it
> before the operation (hint: it's free). I think I included inversion more
> for completeness. Is it something you use often? Since integer division
> is usually so slow, I expect that most people will just opt for floating
> point when they get into that territory.

Fixed-point numbers are used in plenty of places where speed is not an issue
-- modeling signal processing circuits in software is one example, and
firmware in embedded control systems with no floating point unit is another.
In such cases, falling back to floating-point is not an option. Implementing
dividers in hardware is a tricky task, especially since most dividers are
serial, but with some parallelization or statistical rounding. Getting
division and CORDIC working correctly are pretty much the only non-trivial
challenges in low-to-medium speed fixed-point circuit design. At high speeds,
carry propagation latency can be tricky as well.

Regards,
Ravi


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