Five binary arithmetic operators and two unary arithmetic operators (Table 15) can be used in arithmetic expressions. They are represented by specific characters that must be preceded and followed by a space.
Table 15. Binary and Unary Operators | |||
Binary Operator |
Meaning |
Unary Operator |
Meaning |
---|---|---|---|
+ | Addition | + | Multiplication by +1 |
- | Subtraction | - | Multiplication by -1 |
* | Multiplication | ||
/ | Division | ||
** | Exponentiation |
Note: Exponents in fixed-point exponential expressions cannot contain more than 9 digits. The compiler will truncate any exponent with more than 9 digits. In this case, the compiler will issue a diagnostic message if the exponent is a literal or constant; if the exponent is a variable or data-name, a diagnostic is issued at run-time.
Parentheses can be used in arithmetic expressions to specify the order in which elements are to be evaluated.
Expressions within parentheses are evaluated first. When expressions are contained within a nest of parentheses, evaluation proceeds from the least inclusive to the most inclusive set.
When parentheses are not used, or parenthesized expressions are at the same level of inclusiveness, the following hierarchic order is implied:
An arithmetic expression can begin only with a left parenthesis, a unary operator, or an operand (that is, an identifier or a literal). It can end only with a right parenthesis or an operand. An arithmetic expression must contain at least one reference to an identifier or a literal.
There must be a one-to-one correspondence between left and right parentheses in an arithmetic expression, with each left parenthesis placed to the left of its corresponding right parenthesis.
If the first operator in an arithmetic expression is a unary operator, it must be immediately preceded by a left parenthesis if that arithmetic expression immediately follows an identifier or another arithmetic expression.
Table 16shows permissible arithmetic symbol pairs. An arithmetic symbol pair is the combination of two such symbols in sequence. In the table:
Table 16. Valid Arithmetic Symbol Pairs | |||||
First Symbol |
Second Symbol | ||||
Identifier or Literal |
* / ** + - |
Unary + or Unary - |
( |
) |
|
---|---|---|---|---|---|
Identifier or Literal | No | Yes | No | No | Yes |
* / ** + - | Yes | No | Yes | Yes | No |
Unary + or Unary - | Yes | No | No | Yes | No |
( | Yes | No | Yes | Yes | No |
) | No | Yes | No | No | Yes |
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.