Boost logo

Boost :

From: Scott McMurray ([hidden])
Date: 2008-08-02 14:04:41

On Fri, Aug 1, 2008 at 04:21, Matt Gruenke <mgruenke_at_[hidden]> wrote:
> The result of x * y is obviously:
> result_int_bits = x_int_bits + y_int_bits
> result_frac_bits = x_frac_bits + y_frac_bits

For unsigned, yes, but if int_bits includes the sign bit, it's
result_int_bits = x_int_bits + y_int_bits - 1

(And it looked in the code like int_bits did, which does match what
boost.integer does, and means you can do fixed_pt<16,16,int32_t>,
which I think is more intuitive than that not actually fitting.)

Boost list run by bdawes at, gregod at, cpdaniel at, john at