Boost logo

Boost :

From: John C. Femiani (john.femiani_at_[hidden])
Date: 2008-07-31 19:15:14


Neal Becker wrote:
> I have the beginning of a fixed-pt binary lib. Fixed-pt is popular in DSP applications. It is integer arithmetic, but keeping track of the binary pt.
>
> It is built on top of constrained_value.
>
> It is small, so I include it here:
Thanks,
I am eagerly waiting for somebody to do something like this.
Why did you choose to base it on constrained values? Couldn't I have
used a bounded int as a base_type parameter, making your fixed_pt class
not dependent on constrained_value anymore?

Also, do your implementations for /= and *= actually round? You actually
seem to be using the round policy for conversions, is that right? Have
you looked at the numeric/conversion stuff? (I haven't grokked it yet).

> //self operator %=(base_type x) { val %= x; return *this; } What
> should this do?
I think perhaps it should behave like fmod (?)
--Johhn


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