From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-05-09 14:57:52
At 02:50 PM 5/9/2001, Rainer Deyke wrote:
>> - A template class with the template parameter being the number
>> of digits to the right of the decimal point.
>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).
>> - 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.
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. Users will do
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk