MPIR and MPFR

MPIR (http://www.mpir.org/) is based on GMP (http://www.gmplib.org) and can run in GMP compatibility mode. Unlike GMP, MPIR (http://www.mpir.org) can be compiled for Windows out-of-the-box.

With the unmodified MPIR 2.7.2 distribution (which you can download from the MPIR website at http://www.mpir.org/mpir-2.7.2.zip), I built MPIR DLLs and Static Libraries, for 32-bit as P3 (Pentium 3) and for 64-bit as Nehalem. This will cover most of the existing Intel machines. I am not sure how the included compilations will behave on AMD processors, but I have not received any complaints so far.

MPFR (http://www.mpfr.org/) is a C library for multiple-precision floating-point computations with correct rounding. It works either with GMP or MPIR. With the unmodified MPFR 3.1.5 distribution (which you can download from the MPFR website at http://www.mpfr.org/mpfr-3.1.5/) and after struggling a bit, I managed to build 32-bit and 64-bit MPFR DLLs and Static Libraries for Windows.

To confirm everything worked as expected I made a full Visual Studio 2017 project and built 32-bit and 64-bit executables to run either dynamically linked or statically linked.

On the MPIR-only test, which consists of a Pollard’s Rho factorization, 64-bit executables performed almost twice as fast as 32-bit executables. This is good news when lots of software actually run slow when compiled as 64-bit.

If you are new to the MPIR/GMP/MPFR Open Source multiple precision packages and want to learn fast how to use them from Visual Studio, then download the complete project from HERE, it is free. It includes the MPIR and MPFR binaries and static libraries (reason why is over 5 MB).

Note: MPIR and MPFR are licensed under LGPL 3.0. Details can be obtained from http://www.gnu.org/copyleft/lesser.html

Using MPIR and MPFR under Windows

An older version of this package, MPFR 3.1.2/MPIR 2.6.0 can still be downloaded from HERE. Since we have not received any bug reports for this package, made available here in 2015, so we assume it is stable.

We have also built MPIR 3.0 (the latest MPIR at the time of this writing), but since it does not appear to make a working match with the latest MPFR (under Windows, at least), we are not publishing it at this moment, but will supply it if requested with a good reason.

We have also an essay about using MPIR and (mostly) MPFR with assembly language.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *