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.

如需更全面地了解编译器优化,请参阅优化注意事项