IBM Extension
IBM Extension

Floating-Point Literals

Numeric literals may be either fixed-point or floating-point numbers. The rules for floating-point literal values are:
  • A floating-point literal is written in the form:
    Read syntax diagramSkip visual syntax diagram
    Format
    
    >>-+-----+--mantissa E--+-----+--exponent----------------------><
       +- + -+              +- + -+             
       '- - -'              '- - -'             
    
    
  • The sign is optional before the mantissa and the exponent; if you omit the sign, the compiler assumes a positive number.
  • The mantissa can contain between 1 and 16 digits. A decimal point must be included in the mantissa.
  • The exponent is represented by an E followed by an optional sign and one, two, or three digits.
  • The magnitude of a floating-point literal value must fall between 2.225073858507201E-308 and 1.797693134862315E+308. For values outside of this range, an E-level diagnostic will be produced and the value will be replaced by either 0 or 1.797693134862315E+308, respectively.
    Note: The range for MVS™ COBOL is 0.54E-78 to 0.72E+76, and the range for OS/2® and AIX® is 2.225E-308 to 1.798E+308.

A floating-point literal is of class numeric and category internal floating-point. In general, a floating-point literal can be used wherever a numeric decimal literal is allowed.

End of IBM Extension
End of IBM Extension