Decimal128 floating-point format

In computing, decimal128 is a decimal floating-point number format that occupies 128 bits in memory. Formally introduced in IEEE 754-2008,[1] it is intended for applications where it is necessary to emulate decimal rounding exactly, such as financial and tax computations.[2]

Format

The decimal128 format supports 34 decimal digits of significand and an exponent range of −6143 to +6144, i.e. ±0.000000000000000000000000000000000×10^−6143 to ±9.999999999999999999999999999999999×10^6144. Because the significand is not normalized, most values with less than 34 significant digits have multiple possible representations; 1 × 102=0.1 × 103=0.01 × 104, etc. This set of representations for a same value is called a cohort. Zero has 12288 possible representations (24576 if both signed zeros are included, in two different cohorts).

Encoding of decimal128 values

Sign Combination Significand continuation
1 bit 17 bits 110 bits
s mmmmmmmmmmmmmmmmm cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

The IEEE 754 standard allows two alternative encodings for decimal128 values:

This standard does not specify how to signify which encoding is used, for instance in a situation where decimal128 values are communicated between systems.

Both alternatives provide exactly the same set of representable numbers: 34 digits of significand and 3 × 212 = 12288 possible exponent values.

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 5 bits in the combination field. The remaining combinations encode infinities and NaNs.

Combination field Exponent Significand Msbits Other
00mmmmmmmmmmmmmmm 00xxxxxxxxxxxx 0ccc
01mmmmmmmmmmmmmmm 01xxxxxxxxxxxx 0ccc
10mmmmmmmmmmmmmmm 10xxxxxxxxxxxx 0ccc
1100mmmmmmmmmmmmm 00xxxxxxxxxxxx 100c
1101mmmmmmmmmmmmm 01xxxxxxxxxxxx 100c
1110mmmmmmmmmmmmm 10xxxxxxxxxxxx 100c
11110mmmmmmmmmmmm ±Infinity
11111mmmmmmmmmmmm NaN. Sign bit ignored. Sixth bit of the combination field determines if the NaN is signaling.

In the case of Infinity and NaN, all other 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

This format uses a binary significand from 0 to 1034 − 1 = 9999999999999999999999999999999999 = 1ED09BEAD87C0378D8E63FFFFFFFF16 = 0111101101000010011011111010101101100001111100000000110111100011011000111001100011111111111111111111111111111111112. The encoding can represent binary significands up to 10 × 2110 − 1 = 12980742146337069071326240823050239 but values larger than 1034 − 1 are illegal (and the standard requires implementations to treat them as 0, if encountered on input).

As described above, the encoding varies depending on whether the most significant 4 bits of the significand are in the range 0 to 7 (00002 to 01112), or higher (10002 or 10012).

If the 2 bits after the sign bit are "00", "01", or "10", then the exponent field consists of the 14 bits following the sign bit, and the significand is the remaining 113 bits, with an implicit leading 0 bit:

 s 00eeeeeeeeeeee   (0)ttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt
 s 01eeeeeeeeeeee   (0)ttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt
 s 10eeeeeeeeeeee   (0)ttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt  

This includes subnormal numbers where the leading significand digit is 0.

If the 2 bits after the sign bit are "11", then the 14-bit exponent field is shifted 2 bits to the right (after both the sign bit and the "11" bits thereafter), and the represented significand is in the remaining 111 bits. In this case there is an implicit (that is, not stored) leading 3-bit sequence "100" in the true significand.

 s 1100eeeeeeeeeeee (100)t tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt
 s 1101eeeeeeeeeeee (100)t tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt
 s 1110eeeeeeeeeeee (100)t tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt tttttttttt

The "11" 2-bit sequence after the sign bit indicates that there is an implicit "100" 3-bit prefix to the significand. Compare having an implicit 1 in the significand of normal values for the binary formats. The "00", "01", or "10" bits are part of the exponent field.

For the decimal128 format, all of these significands are out of the valid range (they begin with 2113 > 1.038 × 1034), and are thus decoded as zero, but the pattern is same as decimal32 and decimal64.

In the above cases, the value represented is

(−1)sign × 10exponent−6176 × significand

If the four bits after the sign bit are "1111" then the value is an infinity or a NaN, as described above:

s 11110 xx...x    ±infinity
s 11111 0x...x    a quiet NaN
s 11111 1x...x    a signalling NaN

Densely packed decimal significand field

In this version, the significand is stored as a series of decimal digits. The leading digit is between 0 and 9 (3 or 4 binary bits), and the rest of the significand uses the densely packed decimal (DPD) encoding.

The leading 2 bits of the exponent and the leading digit (3 or 4 bits) of the significand are combined into the five bits that follow the sign bit.

This twelve bits after that are the exponent continuation field, providing the less-significant bits of the exponent.

The last 110 bits are the significand continuation field, consisting of eleven 10-bit declets.[3] Each declet encodes three decimal digits[3] using the DPD encoding.

If the first two bits after the sign bit are "00", "01", or "10", then those are the leading bits of the exponent, and the three bits after that are interpreted as the leading decimal digit (0 to 7):

   s 00 TTT (00)eeeeeeeeeeee (0TTT)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt] 
   s 01 TTT (01)eeeeeeeeeeee (0TTT)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt] 
   s 10 TTT (10)eeeeeeeeeeee (0TTT)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt]

If the first two bits after the sign bit are "11", then the second two bits are the leading bits of the exponent, and the last bit is prefixed with "100" to form the leading decimal digit (8 or 9):

   s 1100 T (00)eeeeeeeeeeee (100T)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt] 
   s 1101 T (01)eeeeeeeeeeee (100T)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt] 
   s 1110 T (10)eeeeeeeeeeee (100T)[tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt][tttttttttt]

The remaining two combinations (11110 and 11111) of the 5-bit field are used to represent ±infinity and NaNs, respectively.

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.

Densely packed decimal encoding rules[4]
DPD encoded value Decimal digits
Code space
(1024 states)
b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 d2 d1 d0 Values encoded Description Occurrences
(1000 states)
50.0%
(512 states)
a b c d e f 0 g h i 0abc 0def 0ghi (0–7) (0–7) (0–7) 3 small digits 51.2%
(512 states)
37.5%
(384 states)
a b c d e f 1 0 0 i 0abc 0def 100i (0–7) (0–7) (8–9) 2 small digits,
1 large digit
38.4%
(384 states)
a b c g h f 1 0 1 i 0abc 100f 0ghi (0–7) (8–9) (0–7)
g h c d e f 1 1 0 i 100c 0def 0ghi (8–9) (0–7) (0–7)
9.375%
(96 states)
g h c 0 0 f 1 1 1 i 100c 100f 0ghi (8–9) (8–9) (0–7) 1 small digit,
2 large digits
9.6%
(96 states)
d e c 0 1 f 1 1 1 i 100c 0def 100i (8–9) (0–7) (8–9)
a b c 1 0 f 1 1 1 i 0abc 100f 100i (0–7) (8–9) (8–9)
3.125%
(32 states, 8 used)
x x c 1 1 f 1 1 1 i 100c 100f 100i (8–9) (8–9) (8–9) 3 large digits,
b9, b8: don't care
0.8%
(8 states)

The 8 decimal values whose digits are all 8s or 9s have four codings each. The bits marked x in the table above are ignored on input, but will always be 0 in computed results. (The 8 × 3 = 24 non-standard encodings fill in the gap between 103 = 1000 and 210 = 1024.)

In the above cases, with the true significand as the sequence of decimal digits decoded, the value represented is

See also

References

  1. ^ IEEE Computer Society (2008-08-29). IEEE Standard for Floating-Point Arithmetic. IEEE. doi:10.1109/IEEESTD.2008.4610935. ISBN 978-0-7381-5753-5. IEEE Std 754-2008.
  2. ^ Cowlishaw, Mike (2007). "Decimal Arithmetic FAQ – Part 1 – General Questions". speleotrove.com. IBM Corporation. Retrieved 2022-07-29.
  3. ^ a b Muller, Jean-Michel; Brisebarre, Nicolas; de Dinechin, Florent; Jeannerod, Claude-Pierre; Lefèvre, Vincent; Melquiond, Guillaume; Revol, Nathalie; Stehlé, Damien; Torres, Serge (2010). Handbook of Floating-Point Arithmetic (1 ed.). Birkhäuser. doi:10.1007/978-0-8176-4705-6. ISBN 978-0-8176-4704-9. LCCN 2009939668.
  4. ^ Cowlishaw, Michael Frederic (2007-02-13) [2000-10-03]. "A Summary of Densely Packed Decimal encoding". IBM. Archived from the original on 2015-09-24. Retrieved 2016-02-07.

Read other articles:

Gereja WalesYr Eglwys yng NghymruKemandirian1920 (Pembubaran)PrimatUskup Agung Wales(saat ini lowong)PusatCardiffWilayahWales dengan 1,500 kongregasi[1]BahasaWales dan InggrisJumlah umat84,000 anggota,[2] 29,019 Rata-Rata Hadirin Hari Minggu [3]Situs webchurchinwales.org Peta keuskupan dalam Gereja Wales Gereja Wales (bahasa Wales: Yr Eglwys yng Nghymru) adalah gereja Anglikan di Wales, yang terdiri dari enam keuskupan. Gereja tersebut mendefinisikan dirinya sendir...

 

 

Halaman ini berisi artikel tentang SUV Honda. Untuk ATV Honda, lihat Honda Pilot (ATV). Honda PilotInformasiProdusenHondaJuga disebutHonda MR-V (Timur Tengah)Masa produksi2002–sekarangModel untuk tahun2003–sekarangBodi & rangkaKelasMid-size crossover SUVBentuk kerangka5-door SUVTata letakMesin depan, penggerak roda depan/4WDPenyalur dayaMesin3.5 L V6 mesin J HondaTransmisi5-speed automaticKronologiPendahuluHonda Passport Honda Pilot adalah crossover SUV yang diperkenalk...

 

 

Hindi cinema 1920s 1920 1921 1922 1923 19241925 1926 1927 1928 1929 1930s 1930 1931 1932 1933 19341935 1936 1937 1938 1939 1940s 1940 1941 1942 1943 19441945 1946 1947 1948 1949 1950s 1950 1951 1952 1953 19541955 1956 1957 1958 1959 1960s 1960 1961 1962 1963 19641965 1966 1967 1968 1969 1970s 1970 1971 1972 1973 19741975 1976 1977 1978 1979 1980s 1980 1981 1982 1983 19841985 1986 1987 1988 1989 1990s 1990 1991 1992 1993 19941995 1996 1997 1998 1999 2000s 2000 2001 2002 2003 20042005 2006 200...

This article uses bare URLs, which are uninformative and vulnerable to link rot. Please consider converting them to full citations to ensure the article remains verifiable and maintains a consistent citation style. Several templates and tools are available to assist in formatting, such as reFill (documentation) and Citation bot (documentation). (September 2022) (Learn how and when to remove this template message) This article needs additional citations for verification. Please help improve th...

 

 

Gérard Debreu Gérard Debreu (* 4 Juli 1921 di Calais, Prancis; † 31 Desember 2004) adalah ekonom Prancis dan pemenang Penghargaan Bank Swedia dalam Ilmu Ekonomi untuk mengenang Alfred Nobel pada 1983. Tepat sebelum mulainya Perang Dunia II ia menerima gelar sarjana muda, dan pindah ke Ambert untuk mempersiapkan ujian masuk grande école. Lalu ia pindah ke Grenoble dan pada 1941 ia diterima di École Normale Supérieure. Saat menjalani ujian akhir pada 1944, D-Day tiba dan ia mendaftarkan ...

 

 

Santo PausSistus IIIAwal masa kepausan31 Juli 432Akhir masa kepausan18 Agustus 440PendahuluSelestinus IPenerusLeo IInformasi pribadiNama lahirtidak diketahuiLahirtidak diketahuiWafat18 Agustus 440Paus lainnya yang bernama Sistus Paus Sistus III (???-440) adalah Paus Gereja Katolik Roma sejak 31 Juli 432 hingga meninggalnya pada 18 Agustus 440. Nama Sistus sering dikaitkan dengan sebuah bangunan besar Santa Sabina di Bukit Aventinus di Roma, yang dipersembahkan dalam masa kepausannya. Ia juga ...

Voce principale: Sport- und Schwimmverein Jahn 2000 Regensburg. Sport- und Schwimmverein Jahn 2000 RegensburgStagione 2008-2009Sport calcio Squadra Jahn Ratisbona Allenatore Thomas Kristl (1ª-16ª) Markus Weinzierl (17ª-38ª) All. in seconda Dennis Grassow 3. Liga15º posto Maggiori presenzeCampionato: Bambara, Zellner (37)Totale: Bambara, Zellner (37) Miglior marcatoreCampionato: Stoilov (7)Totale: Stoilov (7) StadioJahnstadion Maggior numero di spettatori6 200 vs. Bayern Monaco...

 

 

Australian politician This biography of a living person needs additional citations for verification. Please help by adding reliable sources. Contentious material about living persons that is unsourced or poorly sourced must be removed immediately from the article and its talk page, especially if potentially libelous.Find sources: David Shoebridge – news · newspapers · books · scholar · JSTOR (September 2018) (Learn how and when to remove this message) ...

 

 

ХристианствоБиблия Ветхий Завет Новый Завет Евангелие Десять заповедей Нагорная проповедь Апокрифы Бог, Троица Бог Отец Иисус Христос Святой Дух История христианства Апостолы Хронология христианства Раннее христианство Гностическое христианство Вселенские соборы Н...

此條目或其章節极大或完全地依赖于某个单一的来源。 (2021年2月1日)请协助補充多方面可靠来源以改善这篇条目。致使用者:请搜索一下条目的标题(来源搜索:奈温 — 网页、新闻、书籍、学术、图像),以检查网络上是否存在该主题的更多可靠来源(判定指引) 本页面有缅文字母,操作系统及浏览器須支持特殊字母与符号才能正確显示为缅文字母,否则可能變成乱码�...

 

 

 本表是動態列表,或許永遠不會完結。歡迎您參考可靠來源來查漏補缺。 潛伏於中華民國國軍中的中共間諜列表收錄根據公開資料來源,曾潛伏於中華民國國軍、被中國共產黨聲稱或承認,或者遭中華民國政府調查審判,為中華人民共和國和中國人民解放軍進行間諜行為的人物。以下列表以現今可查知時間為準,正確的間諜活動或洩漏機密時間可能早於或晚於以下所歸�...

 

 

British politician The Right HonourableThe Lord MulleyPCMulley in 1967, when a junior defence ministerShadow Secretary of State for DefenceIn office4 May 1979 – 14 June 1979LeaderJim CallaghanPreceded byIan GilmourSucceeded byWilliam RodgersSecretary of State for DefenceIn office10 September 1976 – 4 May 1979Prime MinisterJim CallaghanPreceded byRoy MasonSucceeded byFrancis PymSecretary of State for Education and ScienceIn office5 March 1975 – 10 September 197...

American large-yield bomb MOAB redirects here. For other uses, see MOAB (disambiguation). GBU-43/B Massive Ordnance Air Blast (MOAB) GBU-43/B on display at the Air Force Armament Museum, Eglin Air Force Base, Florida. Note the grid fins.Place of originUnited StatesService historyIn service2003–presentUsed byUnited States Air ForceWarsWar in AfghanistanProduction historyDesignerAir Force Research LaboratoryDesigned2002ManufacturerMcAlester Army Ammunition PlantProduced200...

 

 

Aviation légère de l'armée de terreAviazione leggera dell'esercito franceseFrench Army Light Aviationinsegna dell'Aviation légère de l'armée de terre Descrizione generaleAttivadal 22 novembre 1954 come parte dell'artiglieriadal 1º luglio 2003 come corpo distinto dall'artiglieria Nazione Francia Servizioaviazione leggera Dimensione~5 900 uomini~422 velivoli Guarnigione/QGVélizy-Villacoublay PatronoSainte Clotilde Sito internethttp://www.defense.gouv.fr/terre Parte diArm�...

 

 

This article may require cleanup to meet Wikipedia's quality standards. No cleanup reason has been specified. Please help improve this article if you can. (January 2012) (Learn how and when to remove this message) Government Property Agency政府產業署Agency overviewFormedApril 1990 (1990-04)JurisdictionGovernment of Hong KongHeadquarters8-9/F, South Tower West Kowloon Government Offices, 11 Hoi Ting Road, Yau Ma Tei, Hong Kong22°16′47″N 114°10′19″E / 22...

Artikel ini membahas provinsi Romawi yang bernama Lusitania. Untuk kapal, lihat RMS Lusitania. Untuk penggunaan lainnya, lihat Lusitania (disambiguasi). Bagian yang diberi warna merah adalah provinsi Lusitania sebagai bagian dari Kekaisaran Romawi, 120 SM Bagian dari seri tentangSejarah Portugal Kuno Iberia prasejarah Pra-Romawi Penaklukan Hispania oleh Romawi Romanisasi Hispania Lusitania Gallaecia Kerajaan Suebi Kerajaan Visigoth Zaman Pertengahan Penaklukan Hispania oleh Bani Umayyah Al-An...

 

 

منتخب بوروندي لكرة القدم معلومات عامة بلد الرياضة  بوروندي الفئة كرة القدم للرجال  رمز الفيفا BDI  الاتحاد اتحاد بوروندي لكرة القدم كونفدرالية كاف (أفريقيا) الملعب الرئيسي ملعب الأمير لويس رواغاسوري الموقع الرسمي الموقع الرسمي  الطاقم واللاعبون القائد سليمان ند�...

 

 

يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. (مارس 2016) هذه قائمة تحتوي على عصور علم الآثار. القارة الإقليم مقالات تحقيب الحقب الرئيسية أفريقيا شمال أفريقيا North Afri...

United States federal prison in Colorado Not to be confused with ADX Florence. United States Penitentiary, Florence HighLocationFremont County,near Florence, ColoradoCoordinates38°21′42″N 105°05′45″W / 38.36167°N 105.09583°W / 38.36167; -105.09583StatusOperationalSecurity classHighPopulation971 (September 2023)Opened1993Managed byFederal Bureau of PrisonsWardenM. Starr The United States Penitentiary, Florence High (USP Florence High) is a high-security Unit...

 

 

单身公主相亲记Princess Single Blind Date in Mind类型偶像劇编剧顾奕、蔡德明、迷茶导演陈铭章主演林志颖、赵靓、郭品超、陈彦妃、洪小玲国家/地区 中国大陆语言普通話字幕中文集数30集每集长度約45分鐘制作制作人姚嘉、周琳共同制作人湖南电视台监制欧阳常林、周琳播出信息 首播频道湖南衛視播出国家/地区 中华人民共和国播出日期2010年9月17日 (2010-09-17)—2010年10...