Extended Precision - Wikipedia
Total Page:16
File Type:pdf, Size:1020Kb
3/20/2018 Extended precision - Wikipedia Extended precision Extended precision refers to floating point number formats that provide greater precision than the basic floating point formats.[1] Extended precision formats support a basic format by minimizing roundoff and overflow errors in intermediate values of expressions on the base format. In contrast to extended precision, arbitrary-precision arithmetic refers to implementations of much larger numeric types (with a storage count that usually is not a power of two) using special software (or, rarely, hardware). Contents Extended precision implementations IBM extended precision formats Microsoft MBF extended precision format IEEE 754 extended precision formats x86 extended precision format Introduction to use Working range Need for the 80-bit format Language support See also References Extended precision implementations IBM extended precision formats The IBM 1130 offered two floating point formats: a 32-bit "standard precision" format and a 40-bit "extended precision" format. Standard precision format contained a 24-bit two's complement significand while extended precision utilized a 32-bit two's complement significand. The latter format could make full use of the cpu's 32-bit integer operations. The characteristic in both formats was an 8-bit field containing the power of two biased by 128. Floating-point arithmetic operations were performed by software, and double precision was not supported at all. The extended format occupied three 16-bit words, with the extra space simply ignored.[2] The IBM System/360 supports a 32-bit "short" floating point format and a 64-bit "long" floating point format.[3] The 360/85 and follow-on System/370 added support for a 128-bit "extended" format.[4] These formats are still supported in the current design, where they are now called the "hexadecimal floating point" (HFP) formats. Microsoft MBF extended precision format The Microsoft BASIC port for the 6502 CPU, such as in adaptations like Commodore BASIC, AppleSoft BASIC, KIM-1 BASIC or MicroTAN BASIC, supported an extended 40-bit variant of the floating point format Microsoft Binary Format (MBF) since 1977.[5] IEEE 754 extended precision formats The IEEE 754 floating point standard recommends that implementations provide extended precision formats. The standard specifies the minimum requirements for an extended format but does not specify an encoding.[6] The encoding is the implementor's choice.[7] The IA32, x86-64, and Itanium processors support an 80-bit "double extended" extended precision format with a 64-bit significand. The Intel 8087 math coprocessor was the first x86 device which supported floating point arithmetic in hardware. It was designed to support a 32-bit "single precision" format and a 64-bit "double precision" format for encoding and interchanging floating point numbers. The temporary real (extended) format was designed not to store data at higher precision as such, but rather primarily to allow for the computation of double results more reliably and accurately by minimising overflow and roundoff-errors in intermediate calculations:[8][9][10] for example, many floating point algorithms (e.g. exponentiation) suffer from significant precision loss when computed using the most direct implementations. To mitigate such issues the internal registers in the 8087 were designed to hold intermediate results in an 80-bit "extended precision" format. The 8087 automatically converts numbers to this format when loading floating point registers from memory and also converts results https://en.wikipedia.org/wiki/Extended_precision 1/6 3/20/2018 Extended precision - Wikipedia back to the more conventional formats when storing the registers back into memory. To enable intermediate subexpressions results to be saved in extended precision scratch variables and continued across programming language statements, and otherwise interrupted calculations to resume where they were interrupted, it provides instructions which transfer values between these internal registers and memory without performing any conversion, which therefore enables access to the extended format for calculations-[11] also reviving the issue of the accuracy of functions of such numbers, but at a higher precision. The floating-point unit (FPU) on all subsequent x86 processors have supported this format. As a result software can be developed which takes advantage of the higher precision provided by this format. William Kahan, a primary designer of the x87 arithmetic and initial IEEE 754 standard proposal notes on the development of the x87 floating point: "An Extended format as wide as we dared (80 bits) was included to serve the same support role as the 13-decimal internal format serves in Hewlett- Packard’s 10-decimal calculators."[12] Moreover, Kahan notes that 64 bits was the widest significand across which carry propagation could be done without increasing the cycle time on the 8087,[13] and that the x87 extended precision was designed to be extensible to higher precision in future processors: "For now the 10-byte Extended format is a tolerable compromise between the value of extra-precise arithmetic and the price of implementing it to run fast; very soon two more bytes of precision will become tolerable, and ultimately a 16-byte format... That kind of gradual evolution towards wider precision was already in view when IEEE Standard 754 for Floating-Point Arithmetic was framed."[14] The Motorola 6888x math coprocessors and the Motorola 68040 and 68060 processors support this same 64-bit significand extended precision type (similar to the Intel format although padded to a 96-bit format with 16 unused bits inserted between the exponent and significand fields[15]). The follow-on Coldfire processors do not support this 96-bit extended precision format.[16] The x87 and Motorola 68881 80-bit formats meet the requirements of the IEEE 754 double extended format,[17] as does the IEEE 754 128-bit format. x86 extended precision format The x86 extended precision format is an 80-bit format first implemented in the Intel 8087 math coprocessor and is supported by all processors that are based on the x86 design which incorporate a floating-point unit (FPU). This 80-bit format uses one bit for the sign of the significand, 15 bits for the exponent field (i.e. the same range as the 128-bit quadruple precision IEEE 754 format) and 64 bits for the significand. The exponent field is biased by 16383, meaning that 16383 has to be subtracted from the value in the exponent field to compute the actual power of 2.[18] An exponent field value of 32767 (all fifteen bits 1) is reserved so as to enable the representation of special states such as infinity and Not a Number. If the exponent field is zero, the value is a denormal number and the exponent of 2 is −16382.[19] In the following table, "s" is the value of the sign bit (0 means positive, 1 means negative), "e" is the value of the exponent field interpreted as a positive integer, and "m" is the significand interpreted as a positive binary number where the binary point is located between bits 63 and 62. The "m" field is the combination of the integer and fraction parts in the above diagram. https://en.wikipedia.org/wiki/Extended_precision 2/6 3/20/2018 Extended precision - Wikipedia Interpretation of the fields of an x86 Extended Precision value Exponent Significand Meaning Bit 63 Bits 62-0 Zero Zero. The sign bit gives the sign of the zero. Zero All Zeros Non-zero Denormal. The value is (−1)s × m × 2−16382 Pseudo Denormal. The 80387 and later properly interpret this value but will not One Anything generate it. The value is (−1)s × m × 2−16382 Bits 63,62 Bits 61-0 Pseudo-Infinity. The sign bit gives the sign of the infinity. The 8087 and 80287 treat Zero this as Infinity. The 80387 and later treat this as an invalid operand. 00 Pseudo Not a Number. The sign bit is meaningless. The 8087 and 80287 treat this as Non-zero a Signaling Not a Number. The 80387 and later treat this as an invalid operand. Pseudo Not a Number. The sign bit is meaningless. The 8087 and 80287 treat this as 01 Anything a Signaling Not a Number. The 80387 and later treat this as an invalid operand. Infinity. The sign bit gives the sign of the infinity. The 8087 and 80287 treat this as a All Ones Zero Signaling Not a Number. The 8087 and 80287 coprocessors used the pseudo-infinity 10 representation for infinities. Non-zero Signalling Not a Number, the sign bit is meaningless. Floating-point Indefinite, the result of invalid calculations such as square root of a negative number, logarithm of a negative number, 0/0, infinity / infinity, infinity times Zero 0, and others when the processor has been configured to not generate exceptions for 11 invalid operands. The sign bit is meaningless. This is a special case of a Quiet Not a Number. Quiet Not a Number, the sign bit is meaningless. The 8087 and 80287 treat this as a Non-zero Signaling Not a Number. Bit 63 Bits 62-0 Unnormal. Only generated on the 8087 and 80287. The 80387 and later treat this as All other Zero Anything values an invalid operand. The value is (−1)s × m × 2e−16383 One Anything Normalized value. The value is (−1)s × m × 2e−16383 In contrast to the single and double-precision formats, this format does not utilize an implicit/hidden bit. Rather, bit 63 contains the integer part of the significand and bits 62-0 hold the fractional part. Bit 63 will be 1 on all normalized numbers. There were several advantages to this design when the 8087 was being developed: 1. Calculations can be completed a little faster if all bits of the significand are present in the register.