CRE Programmer's Guide
Math Functions
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
7-27
Int_to_Decimal
INT err;
s ':=' "1234";
err := RTL_Decimal_to_Int16_(s, 4, r); ! R = 1234;
s ':=' %hB1323334;
err := RTL_Decimal_to_Int16_(s, 5, r); ! R = -1234;
Int_to_Decimal
The Int_to_Decimal functions convert an integer to a character string whose contents
represent a decimal number. You can specify the format in which the sign of the
number is stored in the character string. These functions are not available in the native
CRE library.
int16
int32
int64
contains the value to convert.
str
is a string of up to 19 bytes that contains the result of the conversion.
len
specifies the length of str in bytes.
sign_type
specifies how to represent the sign in the result. Table 7-5 on page 7-29 shows the
literals you can use for
sign_type when you call Int_to_Decimal.
INT PROC RTL_Int16_to_Decimal_( int16, str, len, sign_type );
INT int16; ! in
STRING .EXT str; ! out
INT len; ! in
INT sign_type; ! in TNS only
INT PROC RTL_Int32_to_Decimal_( int32, str, len, sign_type );
INT(32) int32; ! in
STRING .EXT str; ! out
INT len; ! in
INT sign_type; ! in TNS only
INT PROC RTL_Int64_to_Decimal_( int64, str, len, sign_type );
INT(64) int64; ! in
STRING .EXT str; ! out
INT len; ! in
INT sign_type; ! in TNS only