Decimal64 floating-point format: Difference between revisions

Content deleted Content added
m fix tags, replaced: <sup>sign</sub> → <sup>sign</sup> using AWB
Better explanation of combination field
Tag: nonsense characters
Line 9:
 
== Representation of decimal64 values ==
 
{| class="wikitable"
|-
! Sign !! Combination !! Exponent continuation !! Coefficient continuation
|-
! 1 bit !! 5 bits !! 8 bits !! 50 bits
|-
| s || mmmmm || xxxxxxxx || cccccccccccccccccccccccccccccccccccccccccccccccccc
|}
 
IEEE 754 allows two alternative representation methods for decimal64 values. The standard does not specify how to signify which representation is used, for instance in a situation where decimal64 values are communicated between systems:
Line 19 ⟶ 28:
In both cases, the most significant 4 bits of the significand (which actually only have 10 possible values) are combined with the most significant 2 bits of the exponent (3 possible values) to use 30 of the 32 possible values of a 5-bit field. The remaining combinations encode [[infinity|infinities]] and [[NaN]]s.
 
{| class="wikitable"
If the most significant digit of the significand is between 0 and 7 (encodable on three bits ''mmm''), the number begins as follows
|-
 
! Combination field !! Exponent Begins With !! Coefficient Digit !! Other
s 00 xxx xxx..xxx Exponent begins with 00, significand with 0xxx
|-
s 01 xxx xxx..xxx Exponent begins with 01, significand with 0xxx
| 00mmm || 00 || 0mmm || —
s 10 xxx xxx..xxx Exponent begins with 10, significand with 0xxx
|-
 
| 01mmm || 01 || 0mmm || —
If the most significant digit of the significand us 8 or 9 (representable as an binary number ''100m'' where only the bit ''m'' is stored and bits ''100'' are implicit), the number begins as follows:
|-
 
| 10mmm || 10 || 0mmm || —
s 11 00x xxx...xxx Exponent begins with 00, significand with 100x
|-
s 11 01x xxx...xxx Exponent begins with 01, significand with 100x
| 1100m || 00 || 100m || —
s 11 10x xxx...xxx Exponent begins with 10, significand with 100x
|-
 
| 1101m || 11 || 100m || —
The following bits (''xxx...xxx'' in the above) encode the remaining 8 bits of the exponent and the remaining 15 significant digits, but the details vary depending on the encoding alternative used (either the digits of the significand, or bits of the exponent may also come first). There is no particular reason for this difference, other than historical reasons in the eight-year long development of IEEE 754-2008.
|-
 
| 1110m || 00 || 100m || —
The final combinations are used for infinities and NaNs, and are the same for both alternative encodings:
|-
 
| 11110 || — || — || ±Infinity
s 11 110 xxx...xxx ±Infinity (see [[Extended real number line]])
|-
s 11 111 0xx...xxx quiet NaN (sign bit ignored)
| 11111 || — || — || NaN. Sign bit ignored. First bit of exponent continuation field determines if NaN is signaling.
s 11 111 1xx...xxx signaling NaN (sign bit ignored)
|}
 
In the latter cases of Infinity and NaN, all other ''xxx...xxx'' bits of the encoding are ignored. Thus, it is possible to initialize an array to Infinities or NaNs by filling it with a single byte value.
 
=== Binary integer significand field ===