Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2002-08-30 22:06:11


> Bill's proposal is excellent. Obviously much thought, work and detail went
> into his fixed decimal class and I'd love to borrow ideas. I don't have any
> formal proposal yet as I'm still bouncing around ideas.

Well, here's one to bounce. Suppose we decide that Bill's proposal defines
the desired interface for fixed_decimals. Perhaps your implementation
idea, which seems to have potential, could be dropped into the current
interface?

However, just scanning Bill's new proposal, it looks like you are going back
to a proposal he has already rejected, that is 'scale' is fixed at
compile time....
 
> The basis of the fixed class I propose is that the fixed point number is
> represented by a single integer variable that can be signed or unsigned, of
> any legal integer size. The class will allow for an arbitrary number of
> bits to be assigned to the integer portion of the fixed point number from
> zero up to an including all the bits in the integer. By keeping the fixed
> number binary, two different fixed point numbers can be efficiently added or
> subtracted with only a single additional shift operation when compared to
> integer arithmetic.
>
> Multiplication and division of large fixed point
> numbers will be a little more complex so not to lose any precision, while
> smaller fixed point numbers can be multipled and divided also with only a
> single additional shift operation when compared to integers.

This is certainly an interesting efficiency, but couldn't we just implement
opreator+, etc with Bill's current class? And anyway, is it really that
much faster than plain integer arithmetic? Just seems like we are optimizing
before we are clear on the interface...

Jeff


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