Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Currency Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

6.6 Rounding

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 rounding policies available for RWDecimal<T> are:

The avilable methods and some examples of their effect are outlined in Table 7.


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 7: 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


Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.