In ILE C, when you use the __precisionof operator
with a packed decimal data type the result is an integer
constant. The __precisionof operator can be applied to
a packed decimal data type or a packed decimal constant
expression. The __precisionof operator tells you the number
of decimal digits p of the packed decimal data
type.
To determine the number of decimal digits p of the packed
decimal data, follow the example shown in Figure 1:
Figure 1. Example of Code that Determines the Number of Decimal Digits
in an Internal Packed Decimal Data Object
#include <decimal.h>
int p,p1;
decimal (5, 2) x;
p=__precisionof(x); /* The result is p=2 */
p1=__precisionof(123.456d); /* The result is p1=3 */
In ILE C++, when you use the member
function PrecisionOf() with a _DecimalT class
template the result is an integer constant. The member function PrecisionOf() can
be applied to a _DecimalT class template object. The member
function PrecisionOf() tells you the number of decimal
digits p of the _DecimalT class template object.
To determine the number of decimal digits p of the _DecimalT class
template object, follow the example shown in :
Figure 2. Example of
Code that Determines the Number of Decimal Digits in an Internal _DecimalT
Class Object
#include <bcd.h>
int p,p1;
_DecimalT <5, 2> x;
p=x.PrecisionOf(); // The result is p=2