Hexadecimal floating point (now called HFP by IBM) is a format for encoding floating-point numbers first introduced on the IBM System/360 computers, and supported on subsequent machines based on that architecture, as well as machines which were intended to be application-compatible with System/360.

In comparison to IEEE 754 floating point, the HFP format has a longer significand, and a shorter exponent. All HFP formats have 7 bits of exponent with a bias of 64. The normalized range of representable numbers is from 16−65 to 1663 (approx. 5.39761 × 10−79 to 7.237005 × 1075).

IBM hexadecimal floating-point

The number is represented as the following formula: (−1)sign × 0.significand × 16exponent−64.

IBM hexadecimal floating-point

Single-precision 32-bit

A single-precision HFP number (called "short" by IBM) is stored in a 32-bit word:

IBM hexadecimal floating-point

{ |

|- style="text-align:center" |style="width:20px"|1 |style="width:20px"| |style="width:50px"|7 |style="width:20px"| |style="width:20px"| |style="width:210px"|24 |style="width:20px"| |style="text-align:left"|(width in bits) |- style="text-align:center" |colspan="1" style="text-align:center;background-color:#FC9"|S |colspan="3" style="text-align:center;background-color:#99F"|Exp |colspan="3" style="text-align:center;background-color:#9F9"|Fraction |colspan="1" style="text-align:center;background-color:#FFF"| |- style="text-align:center" |31 |30 |... |24 |23 |... |0 |align="left"|(bit index)* |- |colspan="8"| * IBM documentation numbers the bits from left to right, so that the most significant bit is designated as bit number 0. |}

In this format the initial bit is not suppressed, and the

radix (hexadecimal) point is set to the left of the significand (fraction in IBM documentation and the figures).

Since the base is 16, the exponent in this form is about twice as large as the equivalent in IEEE 754, in order to have similar exponent range in binary, 9 exponent bits would be required.

Example

Consider encoding the value −118.625 as an HFP single-precision floating-point value.

The value is negative, so the sign bit is 1.

The value 118.62510 in binary is 1110110.1012. This value is normalized by moving the radix point left four bits (one hexadecimal digit) at a time until the leftmost digit is zero, yielding 0.011101101012. The remaining rightmost digits are padded with zeros, yielding a 24-bit fraction of .0111 0110 1010 0000 0000 00002.

The normalized value moved the radix point two hexadecimal digits to the left, yielding a multiplier and exponent of 16+2. A bias of +64 is added to the exponent (+2), yielding +66, which is 100 00102.

Combining the sign, exponent plus bias, and normalized fraction produces this encoding:

{ |

|- style="text-align:center" |style="width:20px;text-align:center;background-color:#FC9"|S |style="width:90px;text-align:center;background-color:#99F"|Exp |style="width:250px;text-align:center;background-color:#9F9"|Fraction |style="text-align:center;background-color:#FFF"| |- style="text-align:center" |style="text-align:center;background-color:#FEC"| |style="text-align:center;background-color:#CCF"| |style="text-align:center;background-color:#CFC"| |style="text-align:center;background-color:#FFF"| |}

In other words, the number represented is −0.76A00016 × 1666 − 64 = −0.4633789… × 16+2 = −118.625

Largest representable number

{ |

|- style="text-align:center" |style="width:20px;text-align:center;background-color:#FC9"|S |style="width:90px;text-align:center;background-color:#99F"|Exp |style="width:250px;text-align:center;background-color:#9F9"|Fraction |style="text-align:center;background-color:#FFF"| |- style="text-align:center" |style="text-align:center;background-color:#FEC"| |style="text-align:center;background-color:#CCF"| |style="text-align:center;background-color:#CFC"| |style="text-align:center;background-color:#FFF"| |}

The number represented is +0.FFFFFF16 × 16127 − 64 = (1 − 16−6) × 1663 ≈ +7.2370051 × 1075

Smallest positive normalized number

{ |

|- style="text-align:center" |style="width:20px;text-align:center;background-color:#FC9"|S |style="width:90px;text-align:center;background-color:#99F"|Exp |style="width:250px;text-align:center;background-color:#9F9"|Fraction |style="text-align:center;background-color:#FFF"| |- style="text-align:center" |style="text-align:center;background-color:#FEC"| |style="text-align:center;background-color:#CCF"| |style="text-align:center;background-color:#CFC"| |style="text-align:center;background-color:#FFF"| |}

The number represented is +0.116 × 160 − 64 = 16−1 × 16−64 ≈ +5.397605 × 10−79.