Here is a summary of coding rules for arithmetic expressions:
- Unary (operating on one value) operators and binary (operating
on two values) operators are allowed in arithmetic expressions.
- An arithmetic expression can have one or more unary operators
preceding any term in the expression or at the beginning of the expression.
The unary operators are + (positive) and - (negative).
- The binary operators that can be used to combine the terms of
an expression are + (addition), - (subtraction), * (multiplication), and / (division).
- An arithmetic expression must not begin with a binary operator,
and it must not contain two binary operators in succession.
- An arithmetic-valued function is a term.
- An arithmetic expression must not contain two terms in succession.
- An arithmetic expression must not contain a decimal point. For
example, 123.456 is not a valid arithmetic term,
but 123 is.
- An arithmetic expression must not contain spaces between an operator
and a term, nor between two successive operators except for built-in
functions using the "logical-expression format" described at Logical (SETB) expressions.
- Ordinary symbols specified in arithmetic expressions must be defined
before the arithmetic expression is encountered, and must have an
absolute value.
- An arithmetic expression can contain up to 24 unary and binary
operators, and is limited to 255 levels of parentheses. The parentheses
required for sublist notation, substring notation, and
subscript notation count toward this limit.
An arithmetic expression
must not contain two terms in succession; however, any term can be
preceded by up to 24 unary operators. +&A*-&B is a valid operand for a SETA instruction. The expression &FIELD+- is invalid because it has no final term.