Previous Topic Next topic Print topic


FP-ROUNDING

Determines whether one floating-point receiving item can affect the results of other, nonfloating-point receiving items.

Syntax:

 >>-.---.-.---FP-ROUNDING--"dialect"----.--------><  
    +-/-+ +-NOFP-ROUNDING---------------+

Parameters:

dialect COB370, ISO2002, ENTCOBOL, MVS, OS390, OSVS or VSC2 .

Properties:

Default: NOFP-ROUNDING (Dialect)
Phase: Syntax check
$SET: Any

Comments:

FP-ROUNDING"ISO2002" is the equivalent of NOFP-ROUNDING.

With all possible values of dialect except ISO2002, if any of the sending data items of an arithmetic statement are floating-point, all receiving fields are rounded, regardless of the presence or absence of the ROUNDED phrase and regardless of whether or not the receiving fields are floating-point.

With all possible values of dialect except ISO2002 and OSVS, if any receiving data item is defined as floating-point, rounding takes place for all receiving data items regardless of the presence or absence of the ROUNDED phrase, of whether or not the receiving field is floating-point, and of whether or not there are any sending items which are floating-point.

With NOFP-ROUNDING or FP-ROUNDING"ISO2002", no rounding takes place for fixed-point targets in calculations involving floating-point operands unless the ROUNDED phrase is explicitly used in the source.

Example:

If two data items are defined as follows:

     05 numeric-field    pic 999.
     05 floating-field   comp-1.

and the following statement is executed:

     compute numeric-field floating-field = 7.7 + 1

specifying FP-ROUNDING"VSC2" or FP-ROUNDING"COB370" results in numeric-field containing 9 (rounded), whereas specifying NOFP-ROUNDING, FP-ROUNDING"ISO2002" or FP-ROUNDING"OSVS" would result in numeric-field containing 8 (truncated).

If, using the same two data items, the following statement is executed:

compute numeric-field = +7.6E0

specifying FP-ROUNDING"VSC2", FP-ROUNDING"COB370" or FP-ROUNDING"OSVS" results in numeric-field containing 8 (rounded), whereas specifying NOFP-ROUNDING or FP-ROUNDING"ISO2002" results in numeric-field containing 7 (truncated).

Previous Topic Next topic Print topic