CRE Programmer's Guide
Math Functions
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
7-18
Sign
Sign
The Sign functions return their first parameter with the sign adjusted according to the
value specified in their second parameter. These functions are not available in the
native CRE library.
number
is the number whose sign is modified.
sign
determines whether the Sign functions return a positive or negative number.
Return Value
The Sign functions return:
absolute_value(
number) if sign is greater than or equal to 0
-absolute_value(
number) if sign < 0
Example
INT i, j, k;
i := 17;
j := -18;
k := RTL_Sign_Int16_( i, j ); ! k gets -17
k := RTL_Sign_Int16_( j, i ); ! k gets 18
INT PROC RTL_Sign_Int16_( number, sign );
INT number, sign; ! in TNS only
INT(32) PROC RTL_Sign_Int32_( number, sign );
INT(32) number, sign; ! in TNS only
INT(64) PROC RTL_Sign_Int64_( number, sign );
INT(64) number, sign; ! in TNS only
REAL(32) PROC RTL_Sign_Real32_( number, sign );
REAL(32) number, sign; ! in TNS only
REAL(64) PROC RTL_Sign_Real64_( number, sign );
REAL(64) number, sign; ! in TNS only