Implementation of Floating-Point [ Micro Focus COBOL for UNIX COBOL User Guide ] MPE/iX 5.0 Documentation
Micro Focus COBOL for UNIX COBOL User Guide
Implementation of Floating-Point
Micro Focus COBOL provides IEEE floating-point support. The following
sections describe the range of values and the accuracy available using
floating-point support.
Range
The two COBOL floating-point data types provide full IEEE floating-point
precision for all values that lie within the ranges:
COMP-1 from
1.175494351E-38 through 3.402823466E+38
-1.175494351E-38 through -3.402823466E+38
COMP-2 from
2.2250738585072014E-308 through 1.7976931348623158E+308
-2.2250738585072014E-308 through -1.7976931348623158E+308
Accuracy
The following table shows the relationship between storage size and
significance.
------------------------------------------------------------------------------------------
| |
| Type Size Significant digits |
| |
------------------------------------------------------------------------------------------
| |
| COMP-1 4 bytes 6-7 |
| |
| COMP-2 8 bytes 15-16 |
| |
------------------------------------------------------------------------------------------
External Items and Literals
The exponent for an external floating-point data item cannot be more than
two digits long. When a floating-point data item is referenced in an
ACCEPT or DISPLAY statement, then data is transferred via an implicit
external floating-point data item.
The compiler validates floating point literals to ensure their values are
compatible with the mainframe environment. Literal values that do not
lie within the following range will cause a compile-time error:
from 0.54E-78 through 0.72E+76
and from -0.54E-78 through -0.72E+76
MPE/iX 5.0 Documentation