back to index
libmpdec
libmpdec manual
cdecimal Python module
decimal benchmarks
multi precision benchmarks
Python/Java benchmarks
download
development
mailing lists

Libmpdec - a multi precision C decimal arithmetic library

About

Libmpdec is a complete implementation of the General Decimal Arithmetic Specification. The specification, written by Mike Cowlishaw from IBM, defines a general purpose arbitrary precision data type together with rigorously specified functions and rounding behavior. As described in the scope section of the specification, libmpdec will - with minor restrictions - also conform to the IEEE 754-2008 Standard for Floating-Point Arithmetic, provided that the appropriate context parameters are set.

Libmpdec is written in C, but the header files are prepared for use with a C++ compiler. It is intended to be cross platform and has been tested on 64/32-bit Linux, 64/32-bit FreeBSD and OpenBSD, 64/32-bit Windows, 64-bit AIX, 32-bit OpenSolaris and 32-bit Debian Mips.

Correctness

Libmpdec passes IBM's testcases. Many additional testcases have been created for libmpdec, mostly by using Python's decimal arithmetic module. Multi precision arithmetic has been tested against gmp and apfloat.

On Linux, all tests have been run successfully under Valgrind.

Speed

For standard precisions, libmpdec has been briefly tested against the DecNumber and IntelRDFPMathLib libraries in the decimal library benchmark. For high precisions, the multi precision library benchmark compares libmpdec against mpfr and apfloat.

Summarizing the benchmarks, it appears that for low precisions libmpdec compares very well against other decimal libraries while reaching the speed of apfloat for high precisions.



Contact:

Stefan Krah <website @ bytereef.org>