TAL Programmer's Guide

Arithmetic Expressions
Using Expressions
096254 Tandem Computers Incorporated 5–15
Arithmetic
Expressions
An arithmetic expression is a sequence of operands and arithmetic operators that
computes a single numeric value of a specific data type. Following are examples of
arithmetic expressions:
var1 !operand
var1 / var2 !operand arithmetic-operator operand
var1 * (–var2) !operand arithmetic-operator operand
You can append a unary plus operator or a unary minus operator to the leftmost
operand in the expression:
+var1 * 2 !unary plus
–var1 / var2 !unary minus
Arithmetic operators can be signed, unsigned, or logical, as described in this section.
Operands in
Arithmetic Expressions
An operand consists of one or more elements that evaluate to a single value. Table 5-9
describes the operands that can make up an arithmetic expression.
Table 5-9. Operands in Arithmetic Expressions
Element Description Example
Variable The identifier of a simple variable, array element, pointer,
structure data item, or equivalenced variable, with or without
@ or an index
var[10]
Constant A character string or numeric constant 103375
LITERAL The identifier of a named constant file_size
Function invocation The invocation of a procedure that returns a value $LEN (x)
(expression) Any expression, enclosed in parentheses (x := y)
Code space item The identifier of a procedure, subprocedure, or label prefixed
with @ or a read-only array optionally prefixed with @, with or
without an index
@label_a