# Intel® Decimal Floating-Point Math Library

Decimal floating-point operations were a necessity from the beginnings of the modern age of computing. However, the lack of a good standard for decimal computations has led to the existence of numerous proprietary software packages for decimal or decimal-like computation, most based on fixed-point decimal types, and each with its own characteristics and capabilities. A turning point for decimal computation is the revision of the IEEE Standard 754-1985 for Binary Floating-Point Arithmetic (a new standard seems to be close to adoption), as an important addition to it is the definition of decimal floating-point arithmetic. The primary motivation was that decimal arithmetic makes numerical calculations more human-friendly. Results will be as people expect them, identical to what would be obtained using pencil and paper.

Decimal arithmetic also provides a robust, reliable framework for financial applications that are often subject to legal requirements concerning rounding and precision of the results in the areas of banking, telephone billing, tax calculation, currency conversion, insurance, or accounting in general. The binary floating-point arithmetic that computers use does not always satisfy the existing accuracy requirements. For example, (7.00 / 10000.0) * 10000.0 calculated in single precision is 6.9999997504, and not 7.00. Similar examples can be found for double precision, or any other binary floating-point format. The underlying cause is that most decimal fractions, such as 0.1, cannot be represented exactly in binary floating-point format. The IEEE 754R standard proposal attempts to resolve such issues by defining all the rules for decimal floating-point arithmetic in a way that can be adopted and implemented on all computing systems in software, hardware, or a combination of the two.

In planning to improve on how decimal calculations are carried out and at the same time to make Intel Corporation one of the early adopters of the decimal floating-point arithmetic from the IEEE Standard 754R draft, we have implemented in software a decimal floating-point library, posted here. Standardization committees for high-level languages such as C and C++ are already developing plans to add decimal floating-point support to these languages. A software package such as this for decimal floating-point arithmetic can be used as a computation engine by compilers or other tools requiring decimal floating-point support, and it should constitute an attractive option for various financial computations. Our library has already been contributed to GCC 4.3, where it will be used for decimal floating-point calculations on Intel Architecture platforms.

For more complete information about compiler optimizations, see our Optimization Notice.

Top

Hello Ted,
As far as I know only Intel and IBM have support for the IEEE 754-2008 Decimal Floating-Point Arithmetic. Other implementations may exist, but I am not aware of such. The Intel implementation - Intel(r) Decimal Floating-Point Math Library - is available from this web site, and also through the Intel(R) C++ Compiler 11.0 (or newer), GCC 4.3 (or newer), and the Hewlett-Packard C/C++ Compiler for Intel(R) Itanium(TM) platforms.
Thanks,
Marius Cornea

You know, I listened to this talk about Fermi yesterday .. the new NVidea chip ... they said it supports the new IEEE FP standard but were not specific. He assured me it now supported fma but did not know about the new decimal standard. Who is signing up for the new decimal standard?

Hi,
We did test the entire package in Solaris (big endian), and found no issues in the process.
The LIBRARY directory contains RUNSOLARIS, which invokes solarisbuild (shows various options of building the library for Solaris, using BID_BIG_ENDIAN=1).
Please send any errors/issues you find with the tests or documentation either through the Software Support link, or directly to me (marius.cornea@intel.com).
Thank you,
Marius Cornea

The Solaris build scripts assume big endian (SPARC).
Building on x86 will produce 9659 errors for each test.
Fixing this reduces the number of errors to 2, both of which
I'm investigating. (gcc 3.4.3 32 bit).

Where do I submit changes to allow 64 bit builds and to
optionally use the Studio compilers?

Can someone comment on the relative efficiency of decimal floating point versus binary floating point? Also, are there SIMD instructions that can be used to vectorize decimal floating point operations as there is for binary floating point?

Outstanding news.

From what I've gathered, the upcoming C++0x update includes mostly enhancements for library developers. I'm given to understand that IEEE754R for decimal types would *not* be incorporated into the C++ "core language" for the upcoming revision.

Of course, compiler vendors will no doubt take full advantage of it; GCC is a great example. FP decimal support provided through a compiler or even from a(n optionally) linked library might be preferable anyway...

Thank you for the welcome note!
Yes, GCC 4.3 incorporates this library, which is used for decimal floating-point calculations on Intel Architecture and similar platforms.
I think it is too early to integrate the library into Fortran compilers: the Fortran standard committee (unlike the C and C++ standards committees) has not taken any steps yet - I believe - toward defining support for decimal floating-point (I hope they will after IEEE 754R becomes the new IEEE standard for floating-point).

Welcome to the Intel Software Network blogs! I look forward to learning more about the the decimal floating-point library is incorporated into compliers and various financial computations. Great to see that it is in GCC 4.3. Does the current version of Intel C/C++ compiler use this library? Does it makes sense to include it in the fortran complier?