|
Boost : |
From: Bill Seymour (bill-at-the-office_at_[hidden])
Date: 2002-09-04 07:14:07
Jeff Garland wrote:
>
> ... the non-template version [of the fixed-point decimal
> proposal] definitely introduces inefficiencies when the
> scale is known at compile time.
>
Well, objects carry an extra int around with them; and the
scale is passed as an argument to the constructor. The
representation of unity is calculated at construction
time in both designs. That could be done with a recursive
template, though. If enough folks prefer a template
design, I can go back to it. Rounding modes could be
part of the type as well, but I'm not sure that's
desirable.
>
> ... as I recall the template version was already working?
>
Not with MSVC v5. I had to get rid of all the i18n stuff
to get any output; and I wouldn't want to do that for
the final version. Also, I hadn't tested completely
enough to have instantiated all the member templates.
Stephen Nutt (IIRC):
>
> It is not clear to me why [having the scale as part of the
> type] would have added lots of member functions.
>
There would be member function templates for construction,
assignment and the usual op= operators taking decimals of
other scales as arguments; then specializations for
efficiency when the scale is known to be the same.
Jeff Garland:
>
> ... for the most part I'm not to worried about
> interoperation of decimals with different scales.
>
Interest rates and currency.
--Bill Seymour
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk