Decimal64 floating-point format

This is an old revision of this page, as edited by Keka (talk | contribs) at 21:49, 12 July 2009 (Representation of decimal64 values: adding text on the DPD alternative). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computing, decimal64 is a decimal floating-point computer numbering format that occupies 8 bytes (64 bits) in computer memory.

Decimal64 floating point is a relatively new decimal floating-point format, formally introduced in the 2008 version of IEEE 754.

Representation of decimal64 values

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.

In one representation method the significand is represented as binary coded positive integer.

The other, alternative, representation method is based on densely packed decimal for most of the significand (except the most significant digit).


Binary integer significand field

The position of the exponent and significand parts, as well as whether there is an implicit lead "100" bit triplet (see below) depends on the value of the bits following the sign bit (s below).

If the 2 bits after the sign bit are "00", "01", or "10", then the exponent field consists of the 10 bits following the sign bit, and the sigificand are the remaining 53 bits.

s 00eeeeeeee TTTtttttttttttttttttttt tttttttttttttttttttttttttttttt
s 01eeeeeeee TTTtttttttttttttttttttt tttttttttttttttttttttttttttttt
s 10eeeeeeee TTTtttttttttttttttttttt tttttttttttttttttttttttttttttt

This includes representation of subnormal numbers.

If the 4 bits after the sign bit are "1100", "1101", or "1110", then the exponent field consists of the 10 bits following the sign bit and the "11" bits thereafter, and the represented sigificand are in the remaining 51 bits. In this case there is an implicit (that is, not stored) "100" 3-bit sequence in the true significand.

s 11 00eeeeeeee (100)Ttttttttttttttttttttt tttttttttttttttttttttttttttttt
s 11 01eeeeeeee (100)Ttttttttttttttttttttt tttttttttttttttttttttttttttttt
s 11 10eeeeeeee (100)Ttttttttttttttttttttt tttttttttttttttttttttttttttttt

Note that the "11" 2-bit sequence after sign bit indicates that there is an implicit "100" 3-bit lead sequence in the true significand. Compare having an implicit 1 in the significand of normal values for the binary formats. Note also that the "00", "01", or "10" bits are part of the exponent field. Note also that zero (both positive and negative) have very many representations. Also other numbers, subnormal as well as normal, can have multiple representations. Trailing decimal zeroes can be shifted in or out, if possible without changing the value, while adjusting the exponent. This shifting is not a bitwise shift, but division/multiplication by ten.

The true significand is limited to

1017-1 = 9 999 999 999 999 999 = 100 011 100 001 101 111 001 001 101 111 110 000 001 111 111 111 111 1112

If the represented significand value, including the "100" implicit lead bits when the sign bit is followed by "11", is greater than that, then the significand is in error, but is to be interpreted as if it was 0 (including the implicit lead bits).

In the above cases, the value represented is

 

If the five bits after the sign bit are "11110" then the value is an infinity, (compare the extended real number line), with the sign indicated by the sign bit. The remaining 58 bits are ignored.

s 11110 x...x     an infinity

If the six bits after the sign bit are 111110, the value is a quiet NaN. The sign bit and the remaining bits after this special sequence have no meaningful interpretation.

s 111110 x...x    a quiet NaN

If the six bits after the sign bit are 111111, the value is a signalling NaN. The sign bit and the remaining bits after this special sequence have no meaningful interpretation.

s 111111 x...x    a signalling NaN


Densely packed decimal significand field

For the alternative using DPD encoding for most of the significand, the position of the exponent part and significand parts do not move, but the implicit lead bits of the exponent and the lead digit of the significand depend on the five bits that follow the sign bit.

The last 50 bits are the significand field, consisting of 5 "declets". A declet is 10 bits in DPD encoding, coding three decimal digits.

The eight bits before the significand field is the exponent field.

If the first two bits after the sign bit are "00", "01", or "10", then the exponent field has those two bits as (semi)implicit lead bits. The three bits after the "00", "01", or "10" bits are interpreted as the lead decimal digit (0 to 7).

s 00 mmm (00)eeeeeeee (mmm)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt]
s 01 mmm (01)eeeeeeee (mmm)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt]
s 10 mmm (10)eeeeeeee (mmm)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt]

If the 4 bits after the sign bit are "1100", "1101", or "1110", then the exponent field has last two bits of those four bits as (semi)implicit lead bits. The bit just before the exponent field is prefixed with "100" and is interpreted as the lead digit for the significand (8 or 9).

s 1100 m (00)eeeeeeee (100m)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt]
s 1101 m (01)eeeeeeee (100m)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt]
s 1110 m (10)eeeeeeee (100m)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt]

The declets of the significand field are interpreted according to the DPD encoding into 3 decimal digits per declet, following the lead decimal digit. 24 of the declet bit combinations are ill-formed, in which case the significand is in error, but the declet is still interpreted as coding a three-digit decimal sequence.

The encoding for the infinities and NaNs are the same for both alternative encodings.

See also