Extended Precision - X86 Extended Precision 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. 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. 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.

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.

Interpretation of the fields of an x86 Extended Precision value
Exponent Significand Meaning
All Zeros Bit 63 Bits 62-0
Zero Zero Zero. The sign bit gives the sign of the zero.
Non-zero Denormal. The value is (-1)s × m × 2-16382
One Anything Pseudo Denormal. The 80387 and later properly interpret this value but will not generate it.

The value is (-1)s × m × 2-16382

All Ones Bits 63,62 Bits 61-0
00 Zero Pseudo-Infinity. The sign bit gives the sign of the infinity. The 8087 and 80287 treat this as Infinity. The 80387 and later treat this as an invalid operand.
Non-zero Pseudo Not a Number. The sign bit is meaningless. The 8087 and 80287 treat this as a Signaling Not a Number. The 80387 and later treat this as an invalid operand.
01 Anything Pseudo Not a Number. The sign bit is meaningless. The 8087 and 80287 treat this as a Signaling Not a Number. The 80387 and later treat this as an invalid operand.
10 Zero Infinity. The sign bit gives the sign of the infinity. The 8087 and 80287 treat this as a Signaling Not a Number. The 8087 and 80287 coprocessors used the pseudo-infinity representation for infinities.
Non-zero Signalling Not a Number, the sign bit is meaningless.
11 Zero 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 0, and others when the processor has been configured to not generate exceptions for invalid operands. The sign bit is meaningless. This is a special case of a Quiet Not a Number.
Non-zero Quiet Not a Number, the sign bit is meaningless. The 8087 and 80287 treat this as a Signaling Not a Number.
All other values Bit 63 Bits 62-0
Zero Anything Unnormal. Only generated on the 8087 and 80287. The 80387 and later treat this as 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.
  2. A 64-bit significand provides sufficient precision to avoid loss of precision when the results are converted back to double precision format in the vast number of cases.
  3. This format provides a mechanism for indicating precision loss due to underflow which can be carried through further operations. For example, the calculation 2×10-4930 × 3×10-10 × 4×1020 generates the intermediate result 6×10-4940 which is a denormal and also involves precision loss. The product of all of the terms is 24×10-4920 which can be represented as a normalized number. The 80287 could complete this calculation and indicate the loss of precision by returning an "unnormal" result (exponent not 0, bit 63 = 0). Processors since the 80387 no longer generate unnormals and do not support unnormal inputs to operations. They will generate a denormal if an underflow occurs but will generate a normalized result if subsequent operations on the denormal can be normalized.

The 80-bit floating point format was widely available by 1984, after the development of C, Fortran and similar computer languages, which initially offered only the common 32- and 64-bit floating point sizes. On the x86 design most C compilers now support 80-bit extended precision via the long double type, and this was specified in the C99 / C11 standards (IEC 60559 floating-point arithmetic (Annex F)). Compilers on x86 for other languages often support extended precision as well, sometimes via nonstandard extensions: for example, Turbo Pascal offers an extended type, and several Fortran compilers have a REAL*10 type (analogous to REAL*4 and REAL*8). Such compilers also typically include extended-precision mathematical subroutines, such as square root and trigonometric functions, in their standard libraries.

This format gives 18–21 decimal digits of precision (if a decimal string with at most 18 significant decimal is converted to 80-bit IEEE 754 double extended precision and then converted back to the same number of significant decimal, then the final string should match the original; and if an IEEE 754 (80-bit) double extended precision is converted to a decimal string with at least 21 significant decimal and then converted back to double extended, then the final number should match the original(Note: log10(264) ≅ 19.266). It has a range (including subnormals) from approximately 3.65×10−4951 to 1.18×104932.

Read more about this topic:  Extended Precision

Other articles related to "x86 extended precision format, precision, extended precision format, x86":

X86 Extended Precision Format - Need For The 80-bit Format
... A notable example of the need for a minimum of 64 bits of precision in the significand of the extended precision format is the need to avoid precision loss when ... The x86 floating point units do not provide an instruction that directly performs exponentiation ... program can use in sequence to perform exponentiation using the equation In order to avoid precision loss, the intermediate results "log2 x" and "y log2 x" must be computed with ...

Famous quotes containing the words precision and/or extended:

    How should the world be luckier if this house,
    Where passion and precision have been one
    Time out of mind, became too ruinous
    To breed the lidless eye that loves the sun?
    William Butler Yeats (1865–1939)

    The civility which money will purchase, is rarely extended to those who have none.
    Charles Dickens (1812–1870)