Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

6.6 Rounding


NOTE: Class BigDecimalValue gives you the option of using the rounding methods described below or the rounding methods that it provides. See the API documentation for more information on the BigDecimalValue rounding methods.

In addition, class RWMoney provides its own rounding methods. See the description of rounding policies for money calculator objects in Section 4.4.2.

A global round function is provided for each RWDecimal<T> class. For example:

These functions are used to round to a specified number of places after the decimal point. If the third parameter, which specifies the rounding method, is omitted, the default method PLAIN will be used. The available methods and some examples of their effect are outlined in Table 10.


NOTE: The method names in the table below are enumerated in class RWDecimalBase. Enumerators of the same name are provided in class RWMoney, however, in RWMoney the enumerator names are all lower case.

Table 10 -- Rounding Methods

MethodDescription1.251.351.251
PLAIN
Round up on a tie.
1.3
1.4
1.3
UP
Always round up.
1.3
1.4
1.3
DOWN
Always round down.
1.2
1.3
1.2
TRUNCATE
Same as DOWN.
1.2
1.3
1.2
BANKERS
On a tie, round so last digit is even.
1.2
1.4
1.3


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.