
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