ContentsIndexPreviousNext

6.4.1 Arithmetic Operations

The arithmetic statements are ADD, COMPUTE, DIVIDE, MULTIPLY, and SUBTRACT. They have several common features.

1. The data descriptions of the operands need not be the same. Any necessary conversion and decimal point alignment is supplied throughout the calculation.

2. The maximum size of each operand is 18 digits. If the composite of operands contains more than 18 digits, the results will be undefined. The composite of operands is a hypothetical data item resulting from the superposition of the operands aligned on their decimal point.

3. A calculation may result in the compiler's constructing a temporary data item to hold an intermediate result. The temporary item holds the 20 most significant digits of the intermediate result. The truncated low-order digits (if any) are treated as zeros.

4. When the final value of the operation is moved to the resultant field(s), it is transferred according to the MOVE statement rules. Rounding and size error checking occur just before this final move.