Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2001-05-15 11:05:39


Gabriel Dos Reis wrote:
>
> Beman Dawes <bdawes_at_[hidden]> writes:
>
> | > This is problematic. For some operations, it is
> | >wrong to always round 1/2 LSD up: when doing statistical
> | >operations, rounding up or down at random is correct.
> | >Sometimes, truncation is correct (rather than rounding).
> | >
> | > This suggests that you pick one mode (as you have)
> | >for the operator?? forms, but supply the other operations
> | >as named functions, for example
> | >
> | > mul_with_truncate(a,b)
> | > mul_with_rhlsd_up(a,b)
> | > mul_with_rhlsd_ran(a,b)
> | > mul_with_noround(a,b)
> |
> | Maybe. But maybe just stick with one form of rounding, unless there really
> | is some overwhelming need for additional forms.
>
> I think the ability of choosing rounding mode should not be
> overlooked. It is an essential part of LIA-1 and later standards.

In finance there is another, sometimes important way of rounding: On a
tie, round so that the last digit is even. To illustrate that:

0.249 rounds to 0.2
0.25 rounds to 0.2
0.251 rounds to 0.3
0.349 rounds to 0.3
0.35 rounds to 0.4
0.351 rounds to 0.4

A decimal class can be very useful in this sector, so I consider the
rounding-issue as very important.
 
Regards, Daniel

--
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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