PL/I

PL/I

PL/I

 View Only
  • 1.  Curious about MIXEXP for 128-bit HFP value

    Posted Mon March 05, 2018 02:05 PM

    In the Language Reference documentation for the (kinda new) MINEXP builtin, it lists the returned values for the various floating-pt formats of various precisions.

     

    In particular, for the HFP floating-pt formats it says:

     

       Example (z/OS Hexadecimal Values)

           minexp(x) = -64 for x float bin(p), p <= 21

           minexp(x) = -64 for x float bin(p), 21 <p <= 53

           minexp(x) = -50 for x float bin(p), 53 < p

     

    The values of -64 for precisions less than or equal to 53 make sense; but that -50 for precisions greater than 53 is curious.

    In the IBM HFP floating-pt format; shouldn't that also be -64?

    I tested on zOS, and true to the documentation it returns -50.  But I really don't understand where that -50 comes from?   The exponent range of a 128-bit HFP value is the same as that of a 64-bit HFP value (and the same as that of a 32-bit HFP value.)

     

    tdr


  • 2.  Re: Curious about MIXEXP for 128-bit HFP value

    Posted Tue March 06, 2018 08:33 AM

    The -50 comes from the following description of the low-order characteristic in the Principles of Operation, the low-order characteristic being a true representation of the exponent of the low-order half of the mantissa, 14 the number of hexadecimal digits in the upper (and incidentally the lower) half of the number. If the low-order characteristic underflows, then effectively the low-order half of the number is no longer useful, you're left with a double float, not the extended float you think you have...

     

    When a result is generated in the extended format
    and placed in a register pair, the sign of the low-order
    part is made the same as that of the high-order part,
    and, unless the result is a true zero, the low-order
    characteristic is made 14 less than the high-order
    characteristic. When the subtraction of 14 would
    cause the low-order characteristic to become less
    than zero, the characteristic is made 128 greater than
    its correct value. (Thus, the subtraction is performed
    modulo 128.) HFP exponent underflow is indicated
    only when the high-order characteristic underflows.

     

    brataj


  • 3.  Re: Curious about MIXEXP for 128-bit HFP value

    Posted Wed March 07, 2018 03:31 PM

    While that is true - that the low-order characteristic does underflow; it is not true that the low-order portion is unusable and you are only left with the 64-bit value.   

     

    From the principles of operation in the section on "Hexadecimal-Floating-Point":

     

        "The exponent range is the same for the short, long, and extended formats."

     

    Furthermore, from the section on "Equivalent Floating-Point Number Represenations":

     

       "The exponent of an HFP number is represented in the format as an unsigned seven-bit

         binary interger called the characteristic.  The characteristic is obtained by adding 64

         to the exponent value (excess-64 notation).  The range of the characteristic is 0 to 127,

         which corresponds to an exponent range of -64 to +63."

     

    And - again in chapter 18 - we have "HFP Data Formats"

       

       "An extended HFP number has a 28-digit fraction and consists of two long HFP numbers that are called the high-order and low-order parts. The high-order part may be any long HFP number. The fraction of the high-order part contains the leftmost 14 hexadecimal digits of the 28-digit fraction. The characteristic and sign of the high-order part are the characteristic and sign of the extended HFP number. If the high-order part is normalized, the extended number is consid- ered normalized. The fraction of the low-order part contains the rightmost 14 digits of the 28-digit fraction. The sign and characteristic of the low-order part of an extended operand are ignored. "

     

    Thus - while the low-order characteristic does underflow during normalization; it is ignored for any operation; which

    means that the range of an extended-precision floating-pt value is the same as the range of a long-precision or

    short-precision.

     

    The low-order characteristic is not considered during any of the extended floating-pt operations; it is only the number of digits in the fraction

    that changes (from 14 to 28.)

     

     

    So - the proper value for MINEXP of an extended-precision HFP floating point value, I think, is -64, not -50.

     

     

    Interestingly, the values for MAXEXP appear to be correct.

    tdr