Decimal64 floating-point format: Difference between revisions

Content deleted Content added
nicer visualization of DPD encoding, WIP, pls. don't revert, only improve!
Citation bot (talk | contribs)
Removed URL that duplicated identifier. Removed access-date with no URL. | Use this bot. Report bugs. | Suggested by Headbomb | Linked from Wikipedia:WikiProject_Academic_Journals/Journals_cited_by_Wikipedia/Sandbox | #UCB_webform_linked 629/1032
 
(42 intermediate revisions by 15 users not shown)
Line 1:
{{Short description|64-bit computer number format}}
{{lowercase title}}
{{Use dmy dates|date=July 2020|cs1-dates=y}}
{{floating-point}}
In [[computing]], '''decimal64''' is a [[decimal floating point|decimal floating-point]] [[computer numberingnumber format]] that occupies 8 bytes (64 bits) in computer memory.
It is intended for applications where it is requested to come near to schoolhouse math. In contrast to the binaryxxx datatypes the decimalxxx datatypes provide exact calculations '''also with decimal fractions''' and 'nearest, ties away from zero' rounding, in some range, to some precision, to some degree.
 
Decimal64 floating point is a relatively new decimal floating-point format, formally introduced in the [[IEEE 754-2008 revision|2008 versionrevision]]<ref name="IEEE-754_2008">{{cite book |title=IEEE Standard for Floating-Point Arithmetic |author=IEEE Computer Society |date=2008-08-29 |publisher=[[IEEE]] |id=IEEE Std 754-2008 |doi=10.1109/IEEESTD.2008.4610935 |ref=CITEREFIEEE_7542008 |isbn=978-0-7381-5753-5 |url=https://ieeexplore.ieee.org/document/4610935 |access-date=2016-02-08}}</ref> of the [[IEEE 754]] asstandard, wellalso known as with [[ISO/IEC/IEEE 60559:2011]].<ref name="ISO-60559_2011">{{citeCite journalbook |last=ISO/IEC JTC 1/SC 25|title=ISO/IEC/IEEE 60559:2011 — Information technology — Microprocessor Systems — Floating-Point arithmetic |url=httphttps://www.iso.org/isostandard/iso_catalogue/catalogue_tc/catalogue_detail57469.htm?csnumberhtml |publisher=57469ISO |datepages=20111–58 |access-date=2016-02-08June 2011}}</ref>
 
== Format ==
Decimal64 supports 'normal' values that 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>, [[signed zero]]s, signed infinities and [[NaN]] (Not a Number). This format supports two different encodings.
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 binary format of the same size 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 the [[IEEE 754]] decimal formats 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 10000. 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. Each signed zero has 768 possible representations (1536 for all zeros, in two different cohorts).
 
== Encoding of decimal64 values ==
Line 56 ⟶ 59:
| colspan="16" |combination field not! starting with '11', bits ab = 00, 01 or 10
|-
| style="font-family:monospace; background:#cedff2;" | '''a''' || style="font-family:monospace; background:#cedff2;" | '''b''' || style="font-family:monospace; background:#cedff2;" | '''c''' || style="font-family:monospace; background:#cedff2;" | '''d''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cef2e0;" | '''e''' || style="font-family:monospace; background:#cef2e0;" |'''f''' || style="font-family:monospace; background:#cef2e0;" |'''g'''
| || style="font-family:monospace; background:#cedff2;" | '''abcdmmmmmm''' || style="background:#cef2e0;" | {{mono|(0)'''efgtttttttttttttttttttttttttttttttttttttttttttttttttt''' }}
Finite number with small first digit of significand (0&nbsp;..&nbsp;7).
|-
| colspan="16" |combination field starting with '11', but not 1111, bits ab = 11, bits cd = 00, 01 or 10
|-
| 1 || 1 || style="font-family:monospace; background:#cedff2;" | '''c'''|| style="font-family:monospace; background:#cedff2;" | '''d''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''e''' || style="font-family:monospace; background:#cedff2;" | '''f''' || style="font-family:monospace; background:#cef2e0;" | '''g'''
| || style="font-family:monospace; background:#cedff2;" | '''cdmmmmmmef''' || style="background:#cef2e0;" | {{mono|'''100gtttttttttttttttttttttttttttttttttttttttttttttttttt''' }}
Finite number with big first digit of significand (8 or 9).
|-
Line 129 ⟶ 132:
| colspan="16" |combination field not! starting with '11', bits ab = 00, 01 or 10
|-
| style="font-family:monospace; background:#cedff2;" | '''a''' || style="font-family:monospace; background:#cedff2;" | '''b''' || style="font-family:monospace; background:#cef2e0;" | '''c''' || style="font-family:monospace; background:#cef2e0;" | '''d''' || style="font-family:monospace; background:#cef2e0;" | '''e''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m'''
| || style="font-family:monospace; background:#cedff2;" | '''abmmmmmmmm'''|| style="background:#cef2e0;" | {{nowrap|{{mono|(0)'''cde tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt''' }}}}
Finite number with small first digit of significand (0&nbsp;…&nbsp;7).
|-
| colspan="16" |combination field starting with '11', but not 1111, bits ab = 11, bits cd = 00, 01 or 10
|-
| 1 || 1 || style="font-family:monospace; background:#cedff2;" | '''c''' || style="font-family:monospace; background:#cedff2;" | '''d''' || style="font-family:monospace; background:#cef2e0;" | '''e''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m''' || style="font-family:monospace; background:#cedff2;" | '''m'''
| || style="font-family:monospace; background:#cedff2;" | '''cdmmmmmmmm'''|| style="background:#cef2e0;" | {{nowrap|{{mono|'''100e tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt''' }}}}
Finite number with big first digit of significand (8 or 9).
|-
Line 159 ⟶ 162:
|signaling NaN (with payload in significand)
|}
 
 
The DPD/3BCD transcoding for the declets is given by the following table. b9...b0 are the bits of the DPD, and d2...d0 are the three BCD digits.