Floating-point Numbers

This COBOL system provides IEEE floating-point support. This is fully compatible with the various languages supplied by Microsoft, including Microsoft Visual C++ V6.0.

Floating-point values must be in the range:

For COMP-1 data, 8.43E-37 through 3.37E38
  -8.43E-37 through -3.37E38
For COMP-2 data, 4.19E-307 through 1.67E308
  -4.19E-307 through -1.67E308

Note that although the above ranges are supported internally, this COBOL system supports only 2 digit exponents, and the range is effectively:

For COMP-2 data, 4.19E-99 through 1.67E99
  -4.19E-99 through -1.67E99

The accuracy of floating-point values is:

For COMP-1 data (4 bytes) 6-7 significant digits
For COMP-2 data (8 bytes) 15-16 significant digits
For literals, floating-point values must be in the range:
  • 0.54E-78 through 0.72E+76
  • -0.54E-78 through -0.72E+76

Passing floating-point (COMP-1 and COMP-2) items by value between COBOL and non-COBOL programs is not supported under UNIX. The following statements give undefined behavior if data1 is a floating-point item.

In a COBOL program calling a non-COBOL program:

CALL "program" USING BY VALUE data1.
CALL "program" RETURNING data1
In a COBOL program called from a non-COBOL program:

PROCEDURE DIVISION USING BY VALUE data1.
ENTRY "entry" USING BY VALUE data1.
EXIT PROGRAM RETURNING data1.
GOBACK RETURNING data1.