Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2001-05-09 16:46:59


----- Original Message -----
From: "Beman Dawes" <bdawes_at_[hidden]>
To: <boost_at_[hidden]>; <boost_at_[hidden]>
Sent: Wednesday, May 09, 2001 1:57 PM
Subject: Re: [boost] Fixed-Point Decimal Type

> At 02:50 PM 5/9/2001, Rainer Deyke wrote:
>
> >I think there's also a need for non-decimal fixed-point numbers (i.e.
> >hexadecimal digits to the right of the hexadecimal point or such). For
> >this reason I would prefer it if there was instead a template argument
> >N such that multiplies of 1/N are reprsented exactly.
>
> That really sounds like a different class to me. Keep a basic fixed point
> class simple. Parameterization discourages users (to quote Jerry
Schwarz).

Is fixed<100> really that much harder to write than decimal<2>? If so,
implement the latter as a wrapper around the former.

>
> >> - Represent at least 18 decimal digits exactly. (The 18 comes
> >> from prior art on IBM mainframes, and also turns out to be
> >> convenient if the internal representation is a 64-bit int.)
> >
> >I would make the internal representation type another template argument.
>
> No, please don't turn this into a Swiss army knife class. The underlying
> representation is an implementation detail, and shouldn't be part of the
> interface parameterization. If the machine has special fixed point
> hardware (like the decimal arithmetic on some mainframes) the
> implementation should be able to use that hardware.

Special performance optimization is a valid point, but a fairly
insignificant one IMO. You are turning what could be a lightweight wrapper
around an integer into a mysterious black box.

> Classes intended for very wide use and eventual standardization need to be
> kept focused. The committee will reject submissions for having too many
> features much more often than for having too few features.

Consider std::stack and allocators.

> Users will do
> the same.

Users don't need to see this parametrization if a default template argument
is used.

--
Rainer Deyke (root_at_[hidden])
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

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