pTAL Reference Manual (H06.03+)
Built-In Routines
HP pTAL Reference Manual—523746-005
15-13
Type-Conversion Routines
Type-conversion routines that convert an argument from a smaller data type to a larger
data type, such as $DFIX, perform a sign extension of the expression to the high bits.
Type-conversion routines whose names end in R, such as $DBLR, round their results.
All other type-transfer routines truncate their results.
Type-conversion routines round values as follows:
(IF value < 0 THEN value − 5 ELSE value + 5) / 10
That is:
1. If value is negative, 5 is subtracted; if value is positive, 5 is added.
2. Integer division by 10 truncates the result; therefore, if the absolute value of the
least significant digit of the result after initial truncation is 5 or more, one is added
to the absolute value of the final least significant digit.
Rounding has no effect on INT, INT(32), or FIXED expressions.
$FLT INT, INT(32),
FIXED(fpoint ), REAL, or
REAL(64) value
REAL value
$FLTR
INT, INT(32),
FIXED(fpoint ), REAL, or
REAL(64) value
Rounded REAL value
$HIGH
Upper 16 bits of an INT(32)
or EXTADDR value
INT value
$IFIX
Signed INT value FIXED(fpoint ) value
$INT
INT, INT(32), FIXED,
UNSIGNED (1-31), REAL, or
REAL(64) value
Some address types
INT value
$INT_OV
Same as $INT, but sets $OVERFLOW in some cases
$INTR
Low-order 16 bits of an INT,
INT(32), or FIXED value
REAL or REAL(64) value
Rounded INT value
$LFIX
Unsigned INT value FIXED(fpoint ) value
$UDBL
Unsigned INT value INT(32) value
Table 15-3. Built-In Type-Conversion Routines (page 2 of 2)
Routine Converts ... To ...










