The convertNumeric64() function
Converts an input numeric value from its current storage size, precision, and scale to a 64-bit numeric with a new precision and scale.
Description
int64 convertNumeric64(int32 value, int curPrec, int curScale, int
desiredPrec, int desiredScale);
int64 convertNumeric64(int64 value, int curPrec, int curScale, int
desiredPrec, int desiredScale);
int64 convertNumeric64(CNumeric128 value, int curPrec, int curScale,
int desiredPrec, int desiredScale);
value specifies the integer part of the input numeric, which can be either a 32-bit, 64-bit, or 128-bit value.
curPrec and curScale specify the current precision and scale for the input numeric specified in value.
desiredPrec and desiredScale specify the new precision and scale for the converted numeric value. For a 64-bit numeric, the desiredPrec value can range from 10 to 18, and the desiredScale value can range from 0 to (18-desiredPrec). If your wanted precision is in the range of 1 to 9, use the convertNumeric32 function, or if the wanted precision is in the range of 19-38, use the convertNumeric128 function. This helps to ensure that you select the right storage size for the resulting integer portion of the numeric.
Returns
The function returns a 64-bit integer that is compatible with the wanted precision and scale values.
Throws
For a description of the exceptions, see the exceptions for The convertNumeric32() function.