Using the _DecimalT Class Template
When you are working with ILE C++, the
_DecimalT class
template allows representation of up to 63 significant digits, including
integral and fractional parts. The fractional part of a dollar can
be represented accurately by two digits following the decimal point.
Note: In IBM® i 7.1 and earlier
the largest packed decimal representation is 31 digits.
Note: You
do not have to use floating point arithmetic. Floating point is more
suitable for scientific and engineering computations, which often
use numbers that:
- Are much larger than the largest packed decimal variable can store
- Are much smaller than the smallest packed decimal, but do not have enough precision for commercial use
The same declarations and operators that you use on other data
types, such as float, can be applied to _DecimalT class
templates, with the exception of unions and bitwise operators that
do not apply to _DecimalT class templates.
You can:
- Declare type definitions, arrays, and structures that have
_DecimalTclass templates. - Apply arithmetic, relational, assignment, comma, conditional,
equality, logical, and unary operators on the
_DecimalTclass template. - Pass
_DecimalTclass templates in function calls. The_DecimalTclass template is compatible with packed decimal representations in ILE languages. - Define macros, and call library functions with
_DecimalTclass templates. - View the
_DecimalTclass template when you use the ILE system debugger.Note: When you view a_DecimalTclass template, none of the operators are accessible from the debugger. For information on the ILE system debugger, see Debugging Programs.