Arithmetic expressions are used in COBOL to represent a fixed or computed numeric value. An arithmetic expression can be one of the following:
Arithmetic expressions can use five binary and two unary arithmetic operators. A space must precede and follow each operator. The operators are:
Binary Operator | Meaning |
---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
** | Exponentiation |
Unary Operator | Meaning |
---|---|
+ | Multiplication by +1 |
- | Multiplication by -1 |