![]() |
| Welcome to the General Decimal Arithmetic website, which isnow hosted atspeleotrove.com.The page and file names here have not been changed from the namesused on the previous website,www2.hursley.ibm.com. |
The problems of binary floating-point can be avoided by using base 10(decimal) exponents and preserving those exponents where possible.This site describes a decimal arithmetic which achieves the necessaryresults and is suitable for both hardware and softwareimplementation.It brings together the relevant concepts from a number ofANSI, IEEE, ECMA, and ISO standards, andconforms to the decimal formats and arithmetic in theIEEE754 standard (‘754-2008’)publishedby the IEEE in August 2008, and theISO/IEC/IEEE 60559:2011standard, published by ISO in July 2011. IEEE 754-2008 is currentlyundergoing a minor revision.
The decimal-encoded formats and arithmetic described in the newstandard now have many implementations in hardware and software(seelinks below), including:
The combination of formats and arithmetic defined here and in theIEEE 754 and ISO/IEC/IEEE 60559:2011 standards describe a newdecimal data type, in various sizes.Notably, this single data type can be used for integer, fixed-point,and floating-point decimal arithmetic, and the design permitscompatible fixed-size and arbitrary-precision implementations.Further, most existing numeric data in commercial databases arestored in a decimal form (one or two digits per byte), which canbe converted to and from the decimal-encoded formats efficientlyand easily.
The main features of the arithmetic aresummarizedbelow.For the background and rationale for the design of the arithmetic,seeDecimal Floating-Point:Algorism for Computers in the Proceedings of the 16th IEEESymposium on Computer Arithmetic (Cowlishaw, M. F., 2003).
Parts of these decimal arithmetic pages are reproduced with permissionfrom IBM © Copyright 1997, 2008 by International Business MachinesCorporation.Copyright © Mike Cowlishaw 1981, 2015.
Here you will find documentation and downloads fordecimal arithmetic,fixed-size decimal formats (encodings) andtheir performance,thedecNumber reference implementation,theDFPAL PowerPC abstraction layer,and the language-independent testcases.
| Specification [.html |.pdf] | 1.70 | Decimal floating-point arithmetic, with unrounded and integer arithmetic as a subset (IEEE 754 + IEEE 854 + ANSI X3.274 + ECMA 334 + Java 5). |
| Specification [.html |.pdf] | 1.01 | Concrete decimal formats (bit encodings) suitable for hardware or software implementation of native decimal datatypes; these provide up to 7, 16, or 34 digits of precision. |
| Performance [.html |.pdf] | 1.12 | Performance measurements on three implementations that support the IEEE 754 decimal formats. |
| Sample code [.html] | 1.00 | Java classes which illustrate the decimal encoding of decimal floating-point numbers, and the corresponding decoding. |
The package is available under twofree open source licenses (the ICU license isthe simpler and the less restrictive), and is suitable forlittle-endian or big-endian systems which support 32-bit (orwider) integers. It is currently in use on dozens of differentplatforms, including mainframes, PowerPC, ARM-based microcontrollersand tablets, x86, and over 20 varieties of Unix.
| Documentation [.html |.pdf] | 3.68 | Describes the decNumber package, including a User’s Guide section with several examples. |
| Errata | Known bugs and fixes since 3.56, 2007.10.12. | |
| International Components for Unicode (ICU) decNumber package in ICU decNumber .zip download | 3.68 | The ‘decNumber .zip download’ includes the source code (.h and.c files), together with the examples, theICU license, and the documentation in PDF format. |
| GPL open source decNumber C code in GCC decNumber .zip download decExamples.zip | 3.53 | ‘decNumber C code’ links to the open source code (.h and.c files), part of the GCC project (GPL license). The ‘decNumber .zip download’ also includes the source code,etc. ‘decExamples.zip’ contains the example files referred to in the documentation and also thereadme.txt file which has suggestions on how to compile and run the examples. |
| Patches decNumber368-patches-20210522.zip | 3.68 | The decNumber368-patches-20210522.zip file contains three.patch files, contributed by Matthew Hagerty. The patches are needed for the decNumber 3.68 code to compile cleanly with gcc 10.2.0. See the included.txt file and also Matthew Hagerty’sdecNumber github page for more information. |
In addition to arithmetic operations and various utilities, DFPALalso provides conversions between decimal floating point formatsand many other programming language intrinsic data types such asbinary floating point and integers.
| Documentation [.html |as .zip] | 2.20 | The DFPAL User’s guide with overview, examples, compilation instructions, FAQ,etc. |
| Download DFPAL.zip DFPAL.tar.gz | 2.20 | The DFPAL source code (.h and.c files), together with the examples, the International Components for Unicode (ICU) license, the documentation in HTML format,etc. |
| Documentation [.html |.pdf] | 2.44 | Describes the testcase file format, testcase coverage, and testcase sources. |
| Download dectest.zip dectest0.zip | 2.62 | The extended (dectest.zip) and subset (dectest0.zip) testcase files (containing more than 81,300 tests). These cover all the operations and conversions described in the specifications, and include tests for the decimal encodings. |
The decimal arithmetic described here combines the requirements of bothfixed-point and floating-point arithmetic, giving the followingadvantages:
|
|
The links below provide background and related information.
| Some of the links below may be 'broken' (that is, no longer correct, orinvalid). My current strategy is toleave these here because in most cases the original and/ormost recent version of the page can be found at the 'Wayback machine'atthe Internet Archive ‐just copy the URL to the search field there. |
|
|
| Please send any comments or corrections toMike Cowlishaw (mfc),mfc@speleotrove.com; see alsospeleotrove.com. |
| Parts of these decimal arithmetic pages are reproduced with permissionfrom IBM © Copyright 1997, 2008 by International Business MachinesCorporation.Copyright © Mike Cowlishaw 1981, 2015. |