Skip to main content.

libMpIeee

libMpIeee is a C++ software library for radix 2n or 10m mixed precision floating-point arithmetic, that is fully compliant with the IEEE 754/854 standards for floating-point arithmetic.

This implies, among others, that the basic operations as well as the remainder and square root operations are exactly rounded, involving a relative error of at most 0.5 units in the last place (ULP) for round to nearest and 1 ULP for directed roundings. As required by the IEEE 754/854 standards, libMpIeee also provides denormal numbers, signed zeroes, signed infinities and NaN (Not-a-Number).

Moreover, the conversions between decimal and binary are implemented to satisfy the same error bound as the basic operations. The elementary functions are computed with a relative error of at most 1 ULP for round to nearest and 2 ULP for directed roundings.


^ top

Example

The following example code should give you an idea about the usage of libMpIeee. It tries to compute a well-known expression which is often used to illustrate catastrophic cancellation. To see how it behaves in different floating-point environments, it suffices to change the settings of MpIeee::fpEnv (the first three lines in main) and to recompile and rerun the program.

#include <iostream>
#include <string>
#include "MpIeee.hh"

int main()
{
   MpIeee::fpEnv.setRadix( 2 );
   MpIeee::fpEnv.setExponentSize( 15 );  // 11 for double precision
   MpIeee::fpEnv.setPrecision( 256 );    // 53 for double precision

   MpIeee a = 77617.0;
   MpIeee b = 33096.0;
   MpIeee r, x, y, z;
   
   // with a = 77617 and b = 33096, compute the expression
   // 333.75 b^6 + a^2 (11 a^2 b^2 - b^6 - 121 b^4 - 2)
   // + 5.5 b^8 + a / (2b)

   // the computation is split up in 3 parts to show
   // the numerical difficulty when adding x and y

   x = 333.75 * pow(b, 6) + pow(a, 2) * (11 * pow(a, 2) * pow(b, 2)
       - pow(b, 6) - 121 * pow(b, 4) - 2);
   y = 5.5 * pow(b, 8);
   z = a / (2*b);
   r = x + y + z;
   
   std::cout << "x = " << x << std::endl;
   std::cout << "y = " << y << std::endl;
   std::cout << "z = " << z << std::endl;
   std::cout << "r = " << r << std::endl;
   
   return 0;
}

For a thorough discussion on the issues involved in this expression, please refer to A remarkable example of catastrophic cancellation unraveled by A. Cuyt, B. Verdonk, S. Becuwe, and P. Kuterna, Computing, 66:309-320, 2001.


^ top

Download

libMpIeee has an autoconf/automake/libtool configuration system, so you need to have these GNU tools installed. You also need a C++ compiler, preferably (but not excluded to) the GNU compiler collection.

Furthermore, the libMpIeee library depends on the libSpecialValue library. Make sure you have a current version installed.

Currently, no source code is available yet. Instead, we offer binaries of libMpIeee for several platforms. You are encouraged to download and test them – please let us know your experience, so we can work on improving it towards a future release.

Details on how to use libMpIeee can be found in the manual.

Supported platforms

Currently, we only offer binaries for several platforms. Please select the correct packaged file for your distribution. Instructions on the usage of these binaries is included in the packaged file.

GNU/Linux

The following 32-bit binaries have been compiled on SuSE Linux 9.2 (i686) using GCC 3.3.4. It should also be usable on other current GNU/Linux distributions, including Debian, Ubuntu, Gentoo, Fedora, Mandrake.

Mac OS X (Darwin)

The following binaries have been compiled on Mac OS X 10.4.5 (Darwin 8.5.0) using GCC 4.0.1 (provided through the XCode suite of development tools).

Solaris (Sun OS)

The following binaries 32-bit have been compiled on Solaris 10 (Sun OS 5.10) using GCC 3.4.3 (included on the Solaris 10 Companion DVD).

Windows (Win32)

The following binaries have been compiled on Windows 2000 Server using MinGW 3.9 (GCC 3.4.2).


^ top

Documentation

The reference manual for libMpIeee is available online (html), or it can be downloaded for offline view in either ps or pdf format.

Frequently asked questions

Soon, you will find here a list of frequently asked questions.


^ top

Reporting bugs

If you think you have found a bug in the libMpIeee library, please report it to bugs@mpieee.ua.ac.be. But before you do so, have a look below and check whether it is not already known. The FAQ might also clear up things. You can then request a patch to the release you are using by sending an email to the same adres.

Known bugs

Soon, you will find here a list of known bugs.


^ top

Development team

libMpIeee is developed within the research group Computer Arithmetic and Numerical Techniques (CANT) from the Department of Mathematics and Computer Science at the University of Antwerp.

The current responsable team include Annie Cuyt, Brigitte Verdonk, Franky Backeljauw, Stefan Becuwe and Michel Colman.