Decimal64 floating-point format: Difference between revisions

Content deleted Content added
nicer visualization of DPD encoding, WIP, pls. don't revert, only improve!
improved and corrected description, WIP, pls. don't revert, if necessary improve!
Line 9:
 
== Format ==
Decimal64 supports 'normal' values which can have 16 digit precision from {{gaps|±1.000|000|000|000|000|e=-383}} to {{gaps|±9.999|999|999|999|999|e=384}}, plus 'denormal' values with ramp-down relative precision down to ±1.×10<sup>−398</sup>, zero, -/+infinities and NaN (Not a Number). The encoding in [[exponent]] and [[significand]] (other - deprechated - name: mantissa) using a 'combination field', different significand encoding (BID or DPD) and different understanding of significand and 'exponent bias' is somewhat complex, see below.
Decimal64 supports 16 [[decimal digit]]s of [[significand]] and an [[exponent]] range of −383 to +384, i.e. {{gaps|±0.000|000|000|000|000|e=-383}} to {{gaps|±9.999|999|999|999|999|e=384}}. (Equivalently, {{gaps|±0|000|000|000|000|000|e=-398}} to {{gaps|±9|999|999|999|999|999|e=369}}.) In contrast, the corresponding binary format, which is the most commonly used type, has an approximate range of {{gaps|±0.000|000|000|000|001|e=-308}} to {{gaps|±1.797|693|134|862|315|e=308}}. Because the significand is not normalized, most values with less than 16 [[significant digits]] have multiple possible representations; {{gaps|1 × 10<sup>2</sup>|{{=}}|0.1 × 10<sup>3</sup>|{{=}}|0.01 × 10<sup>4</sup>}}, etc. This set of representations for a same value is called a ''[[Cohort (floating point)|cohort]]''. Zero has 768 possible representations (1536 if both [[signed zero]]s are included, in two different cohorts).
 
The corresponding '''binary''' format, which is the most commonly used type in actual IT, supports a range from denormal-min {{gaps|±5|||||e=-324|}}, over normal-min with full 53-bit precision {{gaps|±2.225|073|858|507|201|e=-308|4}} to max {{gaps|±1.797|693|134|862|315|e=+308|7}}.
 
Because the significand for decimalxxx datatypes is not normalized, most values with less than 16 [[significant digits]] have multiple possible representations; 1000000 × 10<sup>-2</sup>=100000 × 10<sup>-1</sup>=10000 × 10<sup>0</sup>=1000 × 10<sup>1</sup> all have the value 10 000. These sets of representations for a same value are called ''[[Cohort (floating point)|cohorts]],'' the different members can be used to denote how many digits of the value are known precisely. Zero has 768 possible representations (1536 if both [[signed zero]]s are included, in two different cohorts).
 
== Encoding of decimal64 values ==