Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Language Reference


Numeric literals

A numeric literal is a character-string whose characters are selected from the digits 0 through 9, a sign character (+ or -), and the decimal point. If the literal contains no decimal point, it is an integer. (In this documentation, the word integer appearing in a format represents a numeric literal of nonzero value that contains no sign and no decimal point, except when other rules are included with the description of the format.) The following rules apply:

The value of a numeric literal is the algebraic quantity expressed by the characters in the literal. The size of a numeric literal is equal to the number of digits specified by the user.

Numeric literals can be fixed-point or floating-point numbers.

Rules for floating-point literal values

The format and rules for floating-point literals are listed below.

Read syntax diagramSkip visual syntax diagram
Format

>>-+----+--mantissaE--+----+--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 one 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 or two digits.
  • The magnitude of a floating-point literal value must fall between 0.54E-78 and 0.72E+76. For values outside of this range, an E-level diagnostic is produced and the value is replaced by either 0 or 0.72E+76, respectively.

Numeric literals are in the numeric data class and category. (Data classes and categories are described under Classes and categories of data.)


Terms of use | Feedback

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