Jump to content

Octuple-precision floating-point format

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by \wowzeryest\ (talk | contribs) at 23:00, 15 May 2015 (Created page with '{{Unreferenced|date=April 2009}} {{Cleanup|date=April 2009}} In computing, '''octuple precision''' is a binary floating-point-based computer number...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)


In computing, octuple precision is a binary floating-point-based computer number format that occupies 32 bytes (256 bits or 64 nibbles) in computer memory. This 256 bit octuple precision is for applications requiring results in higher than quadruple precision. Disclaimer: This format is rarely (if ever) used and very few things support it.

IEEE 754 octuple-precision binary floating-point format: binary128

The IEEE 754 standard specifies a binary128 as having:

This gives from 33 - 36 significant decimal digits precision (if a decimal string with at most 33 significant decimal is converted to IEEE 754 quadruple 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 quadruple precision is converted to a decimal string with at least 36 significant decimal and then converted back to quadruple, then the final number must match the original [1]).

The format is written with an implicit lead bit with value 1 unless the exponent is stored with all zeros. Thus only 112 bits of the significand appear in the memory format, but the total precision is 113 bits (approximately 34 decimal digits, ). The bits are laid out as follows: [[|thumbnail|center]] Octuple persision visual demontration

Exponent encoding

The octuple-precision binary floating-point exponent is encoded using an offset binary representation, with the zero offset being 262143; also known as exponent bias in the IEEE 754 standard.

Thus, as defined by the offset binary representation, in order to get the true exponent the offset of 16383 has to be subtracted from the stored exponent.

The stored exponents 000016 and 7FFF16 are interpreted specially.

Exponent Significand zero Significand non-zero Equation
000016 0, −0 subnormal numbers
000116, ..., 7FFE16 normalized value
7FFF16 ± NaN (quiet, signalling)

The minimum strictly positive (subnormal) value is 2−16494 ≈ 10−4965 and has a precision of only one bit. The minimum positive normal value is 2−16382 ≈ 3.3621 × 10−4932 and has a precision of 112 bits, i.e. ±2 −16494 as well. The maximum representable value is 216384 - 216272 ≈ 1.1897 × 104932.

Quadruple-precision examples

These examples are given in bit representation, in hexadecimal, of the floating-point value. This includes the sign, (biased) exponent, and significand.

0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000  = 0
8000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000  = -0
7fff 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000   = infinity
ffff 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000   = -infinity

By default, 1/3 rounds down like double precision, because of the odd number of bits in the significand. So the bits beyond the rounding point are 0101... which is less than 1/2 of a unit in the last place.

Double-double arithmetic

A common software technique to implement nearly quadruple precision using pairs of double-precision values is sometimes called double-double arithmetic.[2][3][4] Using pairs of IEEE double-precision values with 53-bit significands, double-double arithmetic can represent operations with at least[2] a 2×53=106-bit significand (actually 107 bits[5] except for some of the largest values, due to the limited exponent range), only slightly less precise than the 113-bit significand of IEEE binary128 quadruple precision. The range of a double-double remains essentially the same as the double-precision format because the exponent has still 11 bits,[2] significantly lower than the 15-bit exponent of IEEE quadruple precision (a range of for double-double versus for binary128).

In particular, a double-double/quadruple-precision value q in the double-double technique is represented implicitly as a sum q=x+y of two double-precision values x and y, each of which supplies half of q's significand.[3] That is, the pair (x,y) is stored in place of q, and operations on q values (+,−,×,...) are transformed into equivalent (but more complicated) operations on the x and y values. Thus, arithmetic in this technique reduces to a sequence of double-precision operations; since double-precision arithmetic is commonly implemented in hardware, double-double arithmetic is typically substantially faster than more general arbitrary-precision arithmetic techniques.[2][3]

Note that double-double arithmetic has the following special characteristics:[6]

  • As the magnitude of the value decreases, the amount of extra precision also decreases. Therefore, the smallest number in the normalized range is narrower than double precision. The smallest number with full precision is 1000...02 (106 zeros) × 2−1074, or 1.000...02 (106 zeros) × 2−968. Numbers whose magnitude is smaller than 2−1021 will not have additional precision compared with double precision.
  • The actual number of bits of precision can vary. In general, the magnitude of low-order part of the number is no greater than half ULP of the high-order part. If the low-order part is less than half ULP of the high-order part, significant bits (either all 0's or all 1's) are implied between the significant of the high-order and low-order numbers. Certain algorithms that rely on having a fixed number of bits in the significand can fail when using 128-bit long double numbers.
  • Because of the reason above, it is possible to represent values like 1 + 2−1074, which is the smallest representable number greater than 1.

In addition to the double-double arithmetic, it is also possible to generate triple-double or quad-double arithmetic if higher precision is required without any higher precision floating-point library. They are represented as a sum of three (or four) double-precision values respectively. They can represent operations with at least 159/161 and 212/215 bits respectively.

Similar technique can be used to produce a double-quad arithmetic, which is represented as a sum of two quadruple-precision values. They can represent operations with at least 226 (or 227) bits.[7]

Implementations

Quadruple precision is almost always implemented in software by a variety of techniques (such as the double-double technique above, although that technique does not implement IEEE quadruple precision), since direct hardware support for quadruple precision is extremely rare. One can use general arbitrary-precision arithmetic libraries to obtain quadruple (or higher) precision, but specialized quadruple-precision implementations may achieve higher performance.

Computer-language support

A separate question is the extent to which quadruple-precision types are directly incorporated into computer programming languages.

Quadruple precision is specified in Fortran by the real(real128) (module iso_fortran_env from Fortran 2008 must be used, the constant real128 is equal to 16 on most processors), or as real(selected_real_kind(33, 4931)), or in a non-standard way as REAL*16. (Quadruple-precision REAL*16 is supported by the Intel Fortran Compiler[8] and by the GNU Fortran compiler[9] on x86, x86-64, and Itanium architectures, for example.)

In the C/C++ with a few systems and compilers, quadruple precision may be specified by the long double type, but this is not required by the language (which only requires long double to be at least as precise as double), nor is it common. On x86 and x86-64, the most common C/C++ compilers implement long double as either 80-bit extended precision (e.g. the GNU C Compiler gcc[10] and the Intel C++ compiler with a /Qlong‑double switch[11]) or simply as being synonymous with double precision (e.g. Microsoft Visual C++[12]), rather than as quadruple precision. On a few other architectures, some C/C++ compilers implement long double as quadruple precision, e.g. gcc on PowerPC (as double-double[13][14][15]) and SPARC,[16] or the Sun Studio compilers on SPARC.[17] Even if long double is not quadruple precision, however, some C/C++ compilers provide a nonstandard quadruple-precision type as an extension. For example, gcc provides a quadruple-precision type called __float128 for x86, x86-64 and Itanium CPUs,[18] and some versions of Intel's C/C++ compiler for x86 and x86-64 supply a nonstandard quadruple-precision type called _Quad.[19]

Hardware support

In C++, It is possible to make a library to handle Octuple-precision floating-point arithmetic. Controversially, in theory it is possible to do Octuple-precision floating-point arithmic in binary (but it would be incredibly hard, painful torture).

See also

References

  1. ^ William Kahan (1 October 1987). "Lecture Notes on the Status of IEEE Standard 754 for Binary Floating-Point Arithmetic" (PDF).
  2. ^ a b c d Yozo Hida, X. Li, and D. H. Bailey, Quad-Double Arithmetic: Algorithms, Implementation, and Application, Lawrence Berkeley National Laboratory Technical Report LBNL-46996 (2000). Also Y. Hida et al., Library for double-double and quad-double arithmetic (2007).
  3. ^ a b c J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates, Discrete & Computational Geometry 18:305-363, 1997.
  4. ^ Knuth, D. E. The Art of Computer Programming (2nd ed.). chapter 4.2.3. problem 9.
  5. ^ Robert Munafo F107 and F161 High-Precision Floating-Point Data Types (2011).
  6. ^ 128-Bit Long Double Floating-Point Data Type
  7. ^ sourceware.org Re: The state of glibc libm
  8. ^ "Intel Fortran Compiler Product Brief" (PDF). Su. Retrieved 2010-01-23.
  9. ^ "GCC 4.6 Release Series - Changes, New Features, and Fixes". Retrieved 2010-02-06.
  10. ^ i386 and x86-64 Options, Using the GNU Compiler Collection.
  11. ^ Intel Developer Site
  12. ^ MSDN homepage, about Visual C++ compiler
  13. ^ RS/6000 and PowerPC Options, Using the GNU Compiler Collection.
  14. ^ Inside Macintosh - PowerPC Numerics
  15. ^ 128-bit long double support routines for Darwin
  16. ^ SPARC Options, Using the GNU Compiler Collection.
  17. ^ The Math Libraries, Sun Studio 11 Numerical Computation Guide (2005).
  18. ^ Additional Floating Types, Using the GNU Compiler Collection
  19. ^ Intel C++ Forums (2007).

Source For The Layout Of This Entire Page