Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


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 releases of IBM COBOL before COBOL for OS/390 & VM Version 2 Release 2:

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

This information center is powered by Eclipse technology. (http://www.eclipse.org)