IBM hexadecimal floating-point

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,[1][2][3] as well as machines which were intended to be application-compatible with System/360.

[4][5] In comparison to IEEE 754 floating point, the HFP format has a longer significand, and a shorter exponent.

A single-precision HFP number (called "short" by IBM) is stored in a 32-bit word: 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).

The normalized value moved the radix point two hexadecimal digits to the left, yielding a multiplier and exponent of 16+2.

Called extended-precision by IBM, a quadruple-precision HFP format was added to the System/370 series and was available on some S/360 models (S/360-85, -195, and others by special request or simulated by OS software).

The extended-precision fraction field is wider, and the extended-precision number is stored as two double words (16 bytes): 28 hexadecimal digits of precision is roughly equivalent to 32 decimal digits.

Available arithmetic operations are add and subtract, both normalized and unnormalized, and compare.

Multiply and divide prenormalize unnormalized values, and truncate the result after one guard digit.

"[16] This allowed higher performance for the large System/360 models, and reduced cost for the small ones.

The authors were aware of the potential for precision loss, but assumed that this would not be significant for 64-bit floating-point variables.

Unfortunately, the designers seem not to have been aware of Benford's Law which means that a large proportion of numbers will suffer reduced precision.

The book "Computer Architecture" by two of the System/360 architects quotes Sweeney's study of 1958-65 which showed that using a base greater than 2 greatly reduced the number of shifts required for alignment and normalisation, in particular the number of different shifts needed.

The initial implementation of double precision lacked a guard digit to allow proper rounding, but this was changed soon after the first customer deliveries.