Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Appendix C. Intermediate results and arithmetic precision

The compiler handles arithmetic statements as a succession of operations performed according to operator precedence, and sets up intermediate fields to contain the results of those operations. The compiler uses algorithms to determine the number of integer and decimal places to reserve.

Intermediate results are possible in the following cases:

Example: calculation of intermediate results

The precision of intermediate results depends on whether you compile using the default option ARITH(COMPAT) (referred to as compatibility mode) or using ARITH(EXTEND) (referred to as extended mode).

In compatibility mode, evaluation of arithmetic operations is unchanged from that in IBM VisualAge® COBOL:

In extended mode, evaluation of arithmetic operations has the following characteristics:

related concepts
Formats for numeric data
Fixed-point contrasted with floating-point arithmetic

related references
Fixed-point data and intermediate results
Floating-point data and intermediate results
Arithmetic expressions in nonarithmetic statements
ARITH


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)