TAL Reference Manual
Standard Functions
TAL Reference Manual—526371-001
14-22
Usage Considerations
Usage Considerations
If expression is INT, INT(32), or FIXED(0), $INT returns the low-order (least significant)
16 bits and does not explicitly maintain the sign. No overflow occurs.
If
expression is REAL or REAL(64), $INT returns a fully converted INT value, not a
truncation. If the converted value of
expression is too large to be represented by a 16-
bit two’s complement integer, an overflow trap occurs.
Examples of $INT Function
1. In this example, $INT returns the low-order word of an INT(32) expression:
INT a16; !Declare variables
INT(32) a32 := 65538D;
a16 := $INT (a32); !Return 2, the low-order word
! of an INT(32) expression
2. In this example, $INT returns a fully converted INT value from a REAL expression:
INT intnum; !Declare variables
REAL realnum := 20.0E-1;
intnum := $INT (realnum); !Return 2, the fully converted
! INT value from a REAL
! expression
$INTR Function
The $INTR function returns an INT value from the low-order 16 bits of an INT(32) or
FIXED(0) expression. $INTR returns a fully converted and rounded INT expression
from a REAL or REAL(64) expression.
expression
is an INT, INT(32), FIXED(0), REAL, or REAL(64) expression.
Usage Considerations
If expression is type INT, INT(32) or FIXED(0), $INTR returns the low-order (least
significant) 16 bits and does not explicitly maintain the sign. No overflow occurs.
$INTR
(
expression
)
VST1423.vsd