IBM hexadecimal floating point
computers, and subsequent machines based on that architecture, support a hexadecimal floating-point format.
In comparison to IEEE 754 floating-point, the IBM floating-point format has a longer significand, and a shorter exponent. All IBM floating-point formats have 7 bits of exponent with a bias of 64. The normalized range of representable numbers is from 16−65 to 1663.
The number is represented as the following formula: sign × 0.significand × 16exponent−64.
Single-precision 32-bit
A single-precision binary floating-point number is stored in a 32-bit word:In this format the initial bit is not suppressed, and the
radix point is set to the left of the significand in increments of 4 bits.
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 IBM 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 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 digits to the left, yielding a multiplier and exponent of 16+2. A bias of +64 is added to the exponent, yielding +66, which is 100 00102.
Combining the sign, exponent plus bias, and normalized fraction produces this encoding:
In other words, the number represented is −0.76A00016 × 1666 − 64 = −0.4633789… × 16+2 = −118.625
Largest representable number
The number represented is +0.FFFFFF16 × 16127 − 64 = × 1663 ≈ +7.2370051 × 1075Smallest positive normalized number
The number represented is +0.116 × 160 − 64 = 16−1 × 16−64 ≈ +5.397605 × 10−79.Zero
Zero is represented in normalized form as all zero bits, which is arithmetically the value +0.016 × 160 − 64 = +0 × 16−64 ≈ +0.000000 × 10−79 = 0. Given a fraction of all-bits zero, any combination of positive or negative sign bit and a non-zero biased exponent will yield a value arithmetically equal to zero. However, the normalized form generated for zero by CPU hardware is all-bits zero. This is true for all three floating-point precision formats.Precision issues
Since the base is 16, there can be up to three leading zero bits in the binary significand. That means when the number is converted into binary, there can be as few as 21 bits of precision. Because of the "wobbling precision" effect, this can cause some calculations to be very inaccurate.A good example of the inaccuracy is representation of decimal value 0.1. It has no exact binary or hexadecimal representation. In hexadecimal format, it is represented as 0.19999999...16 or 0.0001 1001 1001 1001 1001 1001 1001...2, that is:
This has only 21 bits, whereas the binary version has 24 bits of precision.
Six hexadecimal digits of precision is roughly equivalent to six decimal digits log10. A conversion of single precision hexadecimal float to decimal string would require at least 9 significant digits in order to convert back to the same hexadecimal float value.
Double-precision 64-bit
The double-precision floating-point format is the same as the "short" format except that the fraction field is wider and the double-precision number is stored in a double word :The exponent for this format covers only about a quarter of the range as the corresponding IEEE binary format.
14 hexadecimal digits of precision is roughly equivalent to 17 decimal digits. A conversion of double precision hexadecimal float to decimal string would require at least 18 significant digits in order to convert back to the same hexadecimal float value.
Extended-precision 128-bit
Called extended-precision by IBM, a quadruple-precision floating-point format was added to the System/370 series and was available on some S/360 models. The extended-precision fraction field is wider, and the extended-precision number is stored as two double words :28 hexadecimal digits of precision is roughly equivalent to 32 decimal digits. A conversion of extended precision hexadecimal float to decimal string would require at least 35 significant digits in order to convert back to the same hexadecimal float value.
Arithmetic operations
Most arithmetic operations truncate like simple pocket calculators. Therefore, 1 − 16−7 = 1. In this case, the result is rounded away from zero.IEEE 754 on IBM mainframes
Starting with the S/390 G5 in 1998, IBM mainframes have also included IEEE binary floating-point units which conform to the IEEE 754 Standard for Floating-Point Arithmetic. IEEE decimal floating-point was added to IBM System z9 GA2 in 2007 using millicode and in 2008 to the IBM System z10 in hardware.Modern IBM mainframes support three floating-point radices with 3 hexadecimal formats, 3 binary formats, and 3 decimal formats. There are two floating-point units per core; one supporting HFP and BFP, and one supporting DFP; there is one register file, FPRs, which holds all 3 formats. Starting with the z13 in 2015, processors have added a vector facility that includes 32 vector registers, each 128 bits wide; a vector register can contain two 64-bit or four 32-bit floating-point numbers. The traditional 16 floating-point registers are overlaid on the new vector registers so some data can be manipulated with traditional floating-point instructions or with the newer vector instructions.
Special uses
The IBM floating-point format is used in:- SAS 5 Transport files as required by the Food and Drug Administration for New Drug Application study submissions,
- GRIB data files to exchange the output of weather prediction models,
- GDS II format files, and
- SEG Y format files.
Systems that use the IBM floating-point format
- IBM System/360
- RCA Spectra 70
- English Electric System 4
- GEC 4000 series minicomputers
- Interdata 16-bit and 32-bit computers
- Texas Instruments 990/12
- Data General minicomputers