From: John Max Skaller (skaller_at_[hidden])
Date: 2001-05-20 01:49:48
Beman Dawes wrote:
> Daniel Frey wrote:
> >In finance there is another, sometimes important way of rounding: On a
> >tie, round so that the last digit is even. To illustrate that:
> Gabriel Dos Reis wrote:
> > I think the ability of choosing rounding mode should not be
> > overlooked. It is an essential part of LIA-1 and later standards.
> I'm convinced.
> So a question is do you support that by having a whole bunch of different
> functions, or by the class template taking some kind of a parameter
> (perhaps a traits or policy class) performing the rounding desired?
Rounding is a property of the operation,
NOT the operands. For example, with args scale n,m,
and result fixed at scake n+m, there's no rounding
If you want scale n * scale n -> scale n,
we could have
template<typename rounding_mode, int n>
and partially specialise per rounding mode, so that
you call by, for example,
This is the same as
except the use of a rounding mode type makes naming
various other functions (such as div, etc) more consistent.
-- John (Max) Skaller, mailto:skaller_at_[hidden] 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk