Content deleted Content added
never mind. The previous edits broke sub and superscripting. Rv to last working version. Find a different way to display these examples. |
Need <includeonly></includeonly> instead of just <includeonly /> Tag: Reverted |
||
Line 50:
These examples are given in bit ''representation'', in [[hexadecimal]], of the floating-point value. This includes the sign, (biased) exponent, and significand.
<pre<includeonly></includeonly>>
≈ 6.4751751194380251109244389582276465525 × 10<sup>−4966</sup>▼
≈ 6.4751751194380251109244389582276465525 ×
</pre>
<pre<includeonly></includeonly>>
≈ 3.3621031431120935062626778173217519551 × 10<sup>−4932</sup>▼
≈ 3.3621031431120935062626778173217519551 ×
</pre>
<pre<includeonly></includeonly>>
≈ 3.3621031431120935062626778173217526026 × 10<sup>−4932</sup>▼
≈ 3.3621031431120935062626778173217526026 ×
</pre>
<pre<includeonly></includeonly>>
≈ 1.1897314953572317650857593266280070162 ×
</pre>
<pre<includeonly></includeonly>>
▲ ≈ 0.9999999999999999999999999999999999037
≈
</pre>
<pre<includeonly></includeonly>>
</pre>
<pre<includeonly></includeonly>>
≈
</pre>
<pre<includeonly></includeonly>>
4000 0000 0000 0000 0000 0000 0000 0000<sub>16</sub> = 2▼
</pre>
<pre<includeonly></includeonly>>
0000 0000 0000 0000 0000 0000 0000 0000<sub>16</sub> = 0▼
</pre>
<pre<includeonly></includeonly>>
7fff 0000 0000 0000 0000 0000 0000 0000<sub>16</sub> = infinity▼
</pre>
<pre<includeonly></includeonly>>
▲ (closest approximation to π)
</pre>
<pre<includeonly></includeonly>>
▲ (closest approximation to 1/3)
(closest approximation to 1/3)
</pre>
By default, 1/3 rounds down like [[double precision]], because of the odd number of bits in the significand. Thus, the bits beyond the rounding point are <code>0101...</code> which is less than 1/2 of a [[unit in the last place]].
Line 108 ⟶ 132:
A 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.<ref>sourceware.org [http://sourceware.org/ml/libc-alpha/2012-03/msg01024.html Re: The state of glibc libm]</ref>
== Implementations ==
Quadruple precision is often 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, {{as of|2016|lc=on}}, less common (see "[[#Hardware support|Hardware support]]" below). 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 language]]s.
Line 128 ⟶ 152:
As of 2024, [[Rust (programming language)|Rust]] is currently working on adding a new <code>f128</code> type for IEEE quadruple-precision 128-bit floats.<ref>{{cite web |last1=Cross |first1=Travis |title=Tracking Issue for f16 and f128 float types |url=https://github.com/rust-lang/rust/issues/116909 |website=GitHub |access-date=2024-07-05}}</ref>
=== Libraries and toolboxes ===
* The [[GNU Compiler Collection|GCC]] quad-precision math library, [https://gcc.gnu.org/onlinedocs/libquadmath libquadmath], provides <code>__float128</code> and <code>__complex128</code> operations.
* The [[Boost (C++ libraries)|Boost]] multiprecision library Boost.Multiprecision provides unified cross-platform C++ interface for <code>__float128</code> and <code>_Quad</code> types, and includes a custom implementation of the standard math library.<ref>{{cite web |title=Boost.Multiprecision – float128 |url=http://www.boost.org/doc/libs/1_58_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/float128.html |access-date=2015-06-22}}</ref>
|