Numeric Subscripts

Numeric subscripts have the format:

        [ sign bit ] [ biased exponent ] [ normalized mantissa ]
        

The sign bit and biased exponent together form the first byte of the numeric subscript. Bit seven (7) is the sign bit. Bits <6:0> comprise the exponent. The remaining bytes preceding the subscript terminator of one null (ASCII 0) byte represent the variable length mantissa. The following description shows how GT.M converts each numeric subscript type to its internal format:

Zero (0) subscript (special case)

  • Represents zero as a single byte with the hexadecimal value 80 and requires no other conversion.

Mantissa

  • Normalizes by adjusting the exponent.

  • Creates packed-decimal representation.

  • If number has an odd number of digits, appends zero (0) to mantissa.

  • Adds one (1) to each byte in mantissa.

Exponent

  • Stores exponent in first byte of subscript.

  • Biases exponent by adding hexadecimal 3F.

    The resulting exponent falls in the hexadecimal range 3F to 7D if positive, and zero (0) to 3E if negative.

Sign

  • Sets exponent sign bit <7> in preparation for sign handling.

  • If mantissa is negative: converts each byte of the subscript (including the exponent) to its one's-complement and appends a byte containing hexadecimal FF to the mantissa.

Example:

        Global Variable Name:
        ----
        ^NAME(.12,0,"STR",-34.56)
        Internal Representation:
        ------------------------
        4E 41 4D 45 0 BE 13 0 80 0 FF 53 54 52 0 3F CA A8 FF 00 00
         N A M E .12 0 S T R -34.56