Rounding
A global round function is provided for each RWDecimal<T> class. For example:
 
RWDecimal<T>
round(const RWDecimal<T>& d, int places,
RWDecimalBase::RoundingMethod method);
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 rounding policies available for RWDecimal<T> are:
*Round up. If the digits the right of the specified decimal place are non-zero, add one to the digit at the specified decimal place and truncate any digits to the right.
*Round down. Truncate all digits to the right of the specified decimal place.
*Plain. If the digit one to the right of the specified decimal place is equal to or greater than 5, add one to the digit at the specified decimal place, then truncate any digits to the right. Otherwise, truncate all digits to the right of the precision position.
*Bankers. Bankers rounding is the same as plain rounding except that in the case of a tie, increment the digit at the specified decimal place if necessary to make it an even number. A tie occurs when the digit to the right of the one at the specified decimal place equals 5, and there are no following non-zero digits. For example, when rounding to one decimal place, the number 2.45 represents a tie. It rounds to 2.4, because the 4 at the specified decimal place is an even number. 2.45000 is also a tie and also rounds to 2.4. However, 2.45001 is not a tie, so it rounds to 2.5 based on the rules for plain rounding.
*Truncate. Truncate is the same as rounding down.
The available methods and some examples of their effect are outlined in Table 6.
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 6 – Rounding Methods 
Method
1.245
1.25
1.251
1.255
1.259
-1.259
1.26500
1.26501
UP
precision = 2
1.25
1.25
1.26
1.26
1.26
-1.26
1.27
1.27
DOWN
precision = 2
1.24
1.25
1.25
1.25
1.25
-1.25
1.26
1.26
PLAIN
precision = 2
1.25
1.25
1.25
1.26
1.26
-1.26
1.27
1.27
BANKERS
precision = 2
1.24
1.25
1.25
1.26
1.26
-1.26
1.26
1.27
TRUNCATE
1.24
1.25
1.25
1.25
1.25
-1.25
1.26
1.26