TAL Reference Manual

Statements
TAL Reference Manual526371-001
12-5
Usage Considerations
variable
is the identifier of a simple variable, array element, simple pointer, structure pointer,
or structure data item, with or without a bit deposit field and/or index. To update a
pointers content, prefix the pointer identifier with @.
expression
is either
An arithmetic expression of the same data type as variable
A conditional expression, which always has an INT result
expression can be a bit extraction value or an identifier prefixed with @ (the
address of a variable).
expression cannot be a constant list.
Usage Considerations
In general, the data types of variable and expression must match. To convert the data
type of
expression to match the data type of variable, use a type-transfer function,
described in Section 14, Standard Functions
.
Assigning Numbers to FIXED Variables
When you assign a number to a FIXED variable, the system scales the value up or
down to match the
fpoint value. If the system scales the value down, you lose some
precision depending on the amount of scaling; for example:
FIXED(2) a;
a := 2.348F; !System scales value to 2.34F
If the ROUND directive is in effect, the system scales the value as needed, then
rounds the value away from zero as follows:
(IF value < 0 THEN value - 5 ELSE value + 5) / 10
For example, if you assign 2.348F to a FIXED(2) variable, the ROUND directive scales
the value by one digit and then rounds it to 2.35F.
Assigning Character Strings
You can assign a character string to STRING, INT, or INT(32) variables.
If you assign a one-character string such as "A" to an INT simple variable, the system
places the value in the right byte of a word and 0 in the left byte. (To store a character
in the left byte, assign the character and a space, as in "A ").
If you assign a character string to a FIXED, REAL, or REAL(64) variable, the compiler
issues error 32 (type incompatibility).