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

>>-+-----+--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 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:
    • 32-bit representation: 1.175(10-38) to 3.403(1038)
    • 64-bit representation: 2.225(10-308) to 1.798(10308)

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