From: Stephen Nutt (snutt_at_[hidden])
Date: 2002-09-04 11:09:35
> I'm thinking of something like
> class sat;
> class modwrap;
> template<class IntType, bool HasIntPart, class Overflow>
> class fixed_point_binary : public Overflow
> // ...
That makes sense. Since you sent me you idea of the template definition,
I'll drag you into discussions I've been having with Jim Grandy about
exactly what the template definition is if you don't mind. I'm keen on
being able to support an arbitary number of integer bits, unto and including
the number of bits in the integer type. While this doesn't match the
J11/WG14 proposal, it will be compatiable. For my project I don't require a
different number of bits in the integer and fraction parts and so I won't
become stubborn if everyone less me I am wrong, but it seems to make sense
for this to be available.
So from this, seems to be some desire to be able to specify the number of
integer bits and fractional bits. For example you may want 6.8 for a total
of 14 bits. The obvious dissadvantages of this is that now three parameters
are required to specify the integer bits, fractional bits and sign, where
otherwise an integer type and number of integer bits would provide all three
peices. Also, if the total number of bits do not add up to the total bits
in an integer type, the template will need to clear out the unused bits
after any operation that may set them, or use them.
> I now think this probably doesn't matter unless you're scaling
> down a double-precision product with shifts and adds. (IIRC,
> it doesn't apply to division.)
Great, one less thing to go and learn about.
Thanks for the book suggestion. I'm off to Amazon.com....
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk