TAL Programmer's Guide
Operands
Using Expressions
096254 Tandem Computers Incorporated 5–5
Specifying Widths
For INT, REAL, and UNSIGNED data types, the value in parentheses is a constant
expression that specifies the width, in bits, of the variable. As of the D20 release, the
constant expression can include LITERALs and DEFINEs (previously declared
constants and text). The result of the constant expression must be one of the following
values:
Data Type Prefix width, in bits
INT 16
*
, 32, or 64
*
REAL 32
*
or 64
UNSIGNED—simple variable,
parameter, or function result
A value in the range 1 through 31
UNSIGNED—array 1, 2, 4, or 8
*
INT(16), INT(64), and REAL(32) are data type aliases, as described in
“Data Type Aliases” later in this section.
Here is an example of a width that includes a LITERAL:
LITERAL dbwd_size = (4 * 8); !INT_SIZE equals 32
INT(dbwd_size) num; !Data type is INT(32)
LITERALs are described later in this section. DEFINEs are described in the TAL
Reference Manual.
Specifying fpoints
For the FIXED data type, fpoint is the implied fixed-point setting. fpoint is an integer in
the range –19 through 19. If you omit fpoint, the default fpoint is 0 (no decimal places).
A positive fpoint specifies the number of decimal places to the right of the decimal
point:
FIXED(3) x := 0.642F; !Stored as 642
A negative fpoint specifies a number of integer places to the left of the decimal point.
To store a FIXED value, a negative fpoint truncates the value leftward from the decimal
point by the specified number of digits. When you access the FIXED value, zeros
replace the truncated digits:
FIXED(-3) y := 642945F; !Stored as 642; accessed
! as 642000
Specifying Asterisks
As of the D20 release, FIXED(*) is a data type notation. If you declare a FIXED(*)
variable, the value stored in the variable is not scaled.