IBM SC34-5764-01 Server User Manual


 
** Raise a number to a whole number power
number
(Prefix −) Same as the subtraction 0 - number
+number
(Prefix +) Same as the addition 0 + number
Using numeric constants and arithmetic operators, you can write arithmetic expressions such as:
7 + 2 /* result is 9 */
7 - 2 /* result is 5 */
7 * 2 /* result is 14 */
7 ** 2 /* result is 49 */
7 ** 2.5 /* result is an error */
Division
Notice that three operators represent division. Each operator computes the result of a division expression
in a different way.
/ Divide and express the answer possibly as a decimal number. For example:
7 / 2 /* result is 3.5 */
6 / 2 /* result is 3 */
% Divide and express the answer as a whole number. The remainder is ignored. For example:
7 % 2 /* result is 3 */
// Divide and express the answer as the remainder only. For example:
7 // 2 /* result is 1 */
Order of Evaluation
When you have more than one operator in an arithmetic expression, the order of numbers and operators
can be critical. For example, in the following expression, which operation does the language processor
perform first?
7+2*(9/3)-1
Proceeding from left to right, the language processor evaluates the expression as follows:
v First it evaluates expressions within parentheses.
v Then it evaluates expressions with operators of higher priority before expressions with operators of
lower priority.
Arithmetic operator priority is as follows, with the highest first:
Table 1. Arithmetic Operator Priority
- + Prefix operators
** Power (exponential)
*/%// Multiplication and division
+ - Addition and subtraction
Thus, the preceding example would be evaluated in the following order:
1. Expression in parentheses
7+2*(9/3)-1
\___/
3
2. Multiplication
Using Variables and Expressions
22
CICS TS for VSE/ESA: REXX Guide