RWMP1Int, RWMP2Int, and RWMP3Int Integer Types
For ease of use, the Currency Module provides the three integer types shown in
Table 4. These types provide 52-bit, 64-bit, and 96-bit precision.
Table 4 – Int types provided in Currency Module
<T> | Decimal digits |
---|
| 15 |
| 18 |
| 28 |
Any number that can be written using 18 digits, a decimal point, and a sign can be represented exactly using an
RWDecimal<RWMP2Int>.
Table 5 describes the size of numbers that can be represented using a given number of digits.
Table 5 – Decimal digits and magnitude (United States convention)
Decimal digits | Magnitude |
---|
3 | Thousands |
6 | Millions |
9 | Billions |
12 | Trillions |
14 | Trillions with two decimal places |
15 | Thousands of trillions |
18 | Trillions with 6 decimal places |
21 | Billions of trillions |
24 | Trillions of trillions |
27 | Trillions of trillions with 3 decimal places |
28 | Millions of trillions with ten decimal places |
Note that the speed of computation falls as the number of bits increases. The
RWDecimal<RWMP1Int> and
RWFixedDecimal<RWMP1Int> classes provide the fastest computations and can deal with numbers that are large enough for the vast majority of financial applications. Classes
RWDecimal<RWMP2Int> and
RWFixedDecimal<RWMP2Int> are slightly slower, but can handle the larger numbers required by some institutions. The
RWDecimal<RWMP3Int> and
RWFixedDecimal<RWMP3Int> classes are slightly slower still, but can handle the overwhelming majority of numbers required for financial applications.