TAL Reference Manual
Standard Functions
TAL Reference Manual—526371-001
14-14
$DFIX Function
2. Here is another example:
REAL realnum := 123.456E0; !Declare variables
INT(32) dblnum;
dblnum := $DBLR (realnum); !Return 123D
$DFIX Function
The $DFIX function returns a FIXED(fpoint) expression from an INT(32) expression.
dbl-expression
is an INT(32) arithmetic expression.
fpoint
is a value in the range –19 through +19 that specifies the position of the implied
decimal point in the result. A positive
fpoint specifies the number of decimal places
to the right of the decimal. A negative
fpoint specifies the number of integer places
to the left of the decimal point.
Usage Consideration
$DFIX converts an INT(32) expression to a FIXED(fpoint) expression by performing the
equivalent of a signed right shift of 32 positions from the left 32 bits into the right 32 bits
of a quadrupleword unit.
Example of $DFIX Function
In this example, $DFIX returns a FIXED(2) value from an INT(32) expression and an
fpoint of 2:
FIXED(2) fixnum; !Declare variables
INT(32) dblnum := -125D;
fixnum := $DFIX (dblnum, 2); !Return -1.25
$DFIX
(
dbl-expression
)
,
fpoint
VST1410.vsd