TAL Programmer's Guide

Arithmetic Expressions
Using Expressions
5–16 096254 Tandem Computers Incorporated
Signed Arithmetic
Operators
Signed arithmetic operators and the operand types on which they can operate are
shown in Table 5-10.
Table 5-10. Signed Arithmetic Operators
Operator Operation Operand Type
*
Example
+ Unary plus Any data type +5
Unary minus Any data type –5
+ Binary signed addition Any data type alpha + beta
Binary signed subtraction Any data type alpha – beta
* Binary signed multiplication Any data type alpha * beta
/ Binary signed division Any data type alpha / beta
*
The data type of the operands must match except as noted in “Data Types of Expressions”
earlier in this section.
Table 5-11 shows the combinations of operand types you can use with a binary signed
arithmetic operator and the result type yielded by such operators. In each
combination, the order of the data types is interchangeable.
Table 5-11. Signed Arithmetic Operand and Result Types
Operand Type Operand Type Result Type Example
STRING STRING INT byte1 + byte2
INT INT INT word1 – word2
INT(32) INT(32) INT(32) dbl1
*
dbl2
REAL REAL REAL real1 + real2
REAL(64) REAL(64) REAL(64) quad1 + quad2
FIXED FIXED FIXED fixed1
*
fixed2
INT STRING INT word1 / byte1
INT UNSIGNED(1–16) INT word + unsign12
INT(32) UNSIGNED(17–31) INT(32) double + unsign20
UNSIGNED(1–16) UNSIGNED(1–16) INT unsign6 + unsign9
UNSIGNED(17–31) UNSIGNED(17–31) INT(32) unsign26 + unsign31
The compiler treats a STRING or UNSIGNED(1–16) operand as an INT operand. If
bit <0> contains a 0, the operand is positive; if bit <0> contains a 1, the operand is
negative.
The compiler treats an UNSIGNED(17–31) operand as a positive INT(32) operand.