In ILE C, when you use the __digitsof operator with a packed
decimal data type the result is an integer constant. The
__digitsof operator can be applied to a packed decimal
data type or a packed decimal constant expression. The
__digitsof operator returns the total number of digits n
in a packed decimal data type.
To determine the number of digits n in a packed decimal data type, follow the example shown in Figure 217:
Figure 217. Example of Code that Determines the Number of Digits in a Packed Decimal Data Type.
#include <decimal.h> int n,n1; decimal (5, 2) x; n = __digitsof(x); /* the result is n=5 */ n1 = __digitsof(1234.567d); /* the result is n1=7 */ |
In ILE C++, when you use the member function DigitsOf() with a
_DecimalT class template the result is an integer constant.
The member function DigitsOf() can be applied to a
_DecimalT class template object. The member function
DigitsOf() returns the total number of digits n in a
_DecimalT class template object.
To determine the number of digits n in a _DecimalT class template object, follow the example shown in Figure 218:
#include <bcd.h> int n,n1; _DecimalT <5, 2> x; n = x.DigitsOf(); // the result is n=5 |
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.