On Fri, 22 Feb 2002, Nicholas Clark wrote: > On Fri, Feb 22, 2002 at 03:08:58AM +0000, Alex Gough wrote: > > =head2 Rounding > > > > The rounding part of the context defines the rounding algoritm to be > > used, the following are provided (examples assume a precision of 5): > > > > =over 4 > > > > =item Round down > > This is rounding to zero, isn't it?
Yes. All three roundings modify the coefficient without reference to its sign. There's no reason why other roundings cannot be suggested, and in time I expect that more will. > > =item Round half up > > This is rounding to nearest (?) Essentially, yes. > > =item Round half even > > This is the standard financial way of rounding? It depends on what your laws are, but round half even is also sometimes called bankers' rounding. > Is there any use in having round to +Inf and round to -Inf? > I can't think where they might be useful, but they are the other two > rounding methods I can think of, so presumably sometimes they are useful. Other roundings can be suggested. I've not yet considered how +Inf and friends will work, although I've left space for their implementation by using some of the object's flags. I suspect the best way forwards is to consider the extended decimal arithmetic, but I'd rather finish the base first. Alex Gough