News and releases!

MPIR 2.7.2 is released!

The main features for this release are:
  • Fix a .so version numbering issue (symptoms were missing symbols from MPIR).

MPIR 2.7.1 is released!

The main features for this release are:
  • Fix bug in Karatsuba assembly code on Windows.
  • Remove recently added basecase division which to be proved buggy.
  • Added some missing information in AUTHORS.
  • Travis continuous integration.
  • Add building of tests to command line build for Windows.
  • Improve speed and tune targets on Windows.
  • Various improvements of MSVC build.

MPIR 2.7.0 is released!

The main new features for this release are:
  • Faster divide-and-conquer division using new algorithm by W. Hart.
  • Many significant number theoretic function speedups from the GMP project by Marco Bodrato, Torbjorn Granlund, Niels Moller and Martin Boij (factorial, multi-factorial, primorial, n-choose-k, nextprime, jacobi symbols)
  • FFT versions of mpn_mulmod_bnm1/p1 to speed up GMP-ECM
  • Switch to much cleaner gcd/gcdext implementation from the GMP project
Important note: mpz_{get,set}_{sx,ux} now only available if stdint.h is included before including gmp/mpir.h or mpirxx.h.

In memory of Jason Moxham, long time MPIR developer who sadly passed away in 2012.

MPIR 2.6.0 released

The main features and changes for this release are:
  • Completely new FFT implementation (William Hart)
  • Capability to deal with full 32/64 bit words on 32/64 bit Windows (Brian Gladman)
  • Python Windows build generator (Brian Gladman)
  • Bugs fixed in Windows karasub assembly code, mpq_cmp_ui declation (reported by David Cleaver), documentation or mpz_powm_ui and in speed/common for dc_bdiv_qr_n.

MPIR 2.5.2 released

The main features and changes for this release are:
  • Fix build bug due to incorrect header in redc_2.c
  • Support more CPUs
  • Additional macros for mpfr-3.1.0 support
  • Redc_1 assembly code for sandybridge and bobcat
  • Support patched versions of gcc-4.3.2

MPIR 2.5.1 released

The main features and changes for this release are:
  • Correct very rare errors in multiplication code
  • Correct very rare errors in GCD,GCDEXT and invert code
  • minor MSVC build fixes
  • addadd addsub subadd sumdiff unconditionally available on all systems
  • redc_2 now available

MPIR 2.5.0 released

The main features and changes for this release are:
  • Correct rounding mode make check tests
  • x86_64 fat build now uses RIP relative addressing
  • Toom22 speedup via assembler
  • New x86_64 assembler code
  • New Toom eval function using the new assembler code
  • Detect another Sandybridge CPU
  • New GCD code (by the GMP project)
  • General cleanup of old features
  • Upgrade internal component YASM
  • MSVC build tweeks
  • New experimental MSVC python build system
  • Remove explicit support for thumb m68k and sh cpu's

MPIR 2.4.0 released

The main features and changes for this release are:
  • Corrected the define __GMP_CC in mpir.h and gmp.h can miss out the the option -std=gnu99
  • Corrected old versions of GAS can fail to assemble the mpn/x86_64/core2/popcount.asm
  • Corrected make install will fail to install the file gmpxx.h (only needed with the configure options --enable-cxx --enable-gmpcompat) when built out of the source tree.
  • Add an alias used by MPFR (snprintf -> _snprintf)
  • Correct incorrect parameter type for mpz_cdiv_q_2exp
  • Corrected CRLF endings in some C files
  • Corrected bitcnt_t functions error return on Win64
  • Sandybridge and Bobcat have been tuned
  • Updated to the latest compiler flags
  • Bulldozer cpu detection
  • Upgrade internal components yasm and autotools
  • General cleanups of sourcebase
  • Initial support for intmax functions
  • Initial support for MSVC command line build for VS2005 and up
  • Support for MSBUILD of VS2010
  • Much more extensive and automated testing system
  • Remove explicit support for arc s390 pa32 pa64

Known issues with MPIR-2.3.1

The define __GMP_CC in mpir.h and gmp.h can miss out the the option -std=gnu99 , to fix just define __GMP_CC as __MPIR_CC

Old versions of GAS can fail to assemble the mpn/x86_64/core2/popcount.asm , to fix just replace all occurrences of movq with movd

Make install will fail to install the file gmpxx.h (only needed with the configure options --enable-cxx --enable-gmpcompat) when built out of the source tree , to fix just copy the mpirxx.h file in the source directory to the installed include directory an rename it as gmpxx.h

MinGW64 builds require a toolchain with a date after 24th April 2010 as the underscore prefix symbols are wrong.

MPIR 2.3.1 released

The main features and changes for this release are:
  • noexecstack enabled for linux only
  • Bug fixed where FAT builds failed on unknown processors
  • Bug fixed where compilers without GAS inline assembler on Unix like systems had a bug on AMD chips , Thanks to Jeff Gilchrist for reporting this bug

MPIR 2.3.0 released

The main features and changes for this release are:
  • noexecstack enabled for x86 properly
  • Detect a few more cpu's correctly
  • New assembler code for x64
  • MinGW64 port with full assembler support
  • MSVC VS2008 port removed

MPIR 2.2.1 released

The main features and changes in this release cycle are:
  • Added a missing windows export declaration
  • Detect a few more cpu's correctly
  • Exported the function mpn_redc_1
  • Renamed the function mpn_redc_basecase to mpn_redc_1 and re-ordered the parameters

MPIR 2.2.0 released

The main features and changes in this release cycle are:
  • Detect a few more cpu's correctly
  • Upgrade internal components yasm,autotools,gnulib
  • Removed the prebuild steps
  • General cleanup of the source base
  • Windows DLL builds can now be tested
  • make check can now run the tests in parallel
  • Initial support for running under MinGW64
  • Enable noexecstack for x86/x86_64 with GCC
  • Removed explicit support for ancient cpu's namely a29k clipper i960* m88* ns32k pyr* z8000* gmicro i860 romp uxp POWER1 POWER2 cray vax
  • Removed explicit support for ancient OS'es namely pw32 djgpp os2 unicos osf tru64
  • Removed the demo's from the library
  • Renamed the internal function mpn_divexact_bybM1of to mpn_divexact_fobm1
  • Windows build directory changes

MPIR 2.1.4 released

The main features and changes in this release cycle are:
  • A parallel make install race condition has been fixed. Thanks to Mitesh Patel and Leif for reporting this bug.

MPIR Benchmark 2 (Brian Gladman, Jeff Gilchrist and Jason Moxham):


N.B: the benchmark is for development purposes only, and will not give a fair comparison between different libraries. See for example the Mersenne and Fermat tests, which use MPIR functionality not necessarily present in other libraries.

IMPORTANT NOTE (updated for MPIR 1.3.0 and following):

By default MPIR produces libmpir, libmpirxx binaries and mpir.h. For libgmp, libgmpxx and gmp.h use the --enable-gmpcompat configure option. (See section 2 of the documentation for more details.) We have removed the previous requirement to type "make install-gmpcompat". Our current release is compatible with documented interface of GMP-5.0.1 except for the mpz_pown_sec function which we don't regard as suitable for inclusion into a general purpose bignum library , and the function mpz_array_init which is an unsafe , old and practically unused function.

Known Issues:

  • All systems: make check fails if build path contained spaces
  • Make tune will core dump with small probability on some loaded machines
  • Fat binary x86_64 build will fail with old GNU and Sun assembler versions
  • Test failure (mpz/t-export) on a Pentium-D with gcc 4.1.2 - appears to be a problem with the C library function memcmp not MPIR
  • MPN_ZERO miscompiles on ia64 with gcc 4.1.2
  • Tuning code fails on mips64el
  • Debian's GCC 4.3.2 miscompiles MPIR on 64 bit systems ; x86_64 is fixed in the configure system but for other cpu's use -O1 or -fno-strict-aliasing
  • If you are having failures when building or tuning, try setting the following prior to configuring and build:
    $ export MAKE='make'
    If you have failures when running the test suite, try edit the file mpirtest to use only one CPU.

The final released version of MPIR 1.3.1 is still available for download here. This version of the library is LGPL v2+. It contains NO LGPL v3+ code, as previous and later versions of MPIR do:

MPIR Version 1.3.1 - source tarball (LGPL v2+)
MPIR Version 1.3.1 - documentation
Archive of previous release announcements

Testing (updated for MPIR 2.1.0):

Here is our current testing matrix.

  • white -- system unavailable for testing. GCC 4.3.2 has a bug which results in miscompiling MPIR. There's no sense in reporting either pass (green) or failure (red) on a broken system. If we can't find a system which is sane for a given architecture/OS combination, we simply leave it white (unavailable). The oldest GCC version that we check is 3.4
  • green -- at least these commands run successfully: ./configure && make && make check. That is, MPIR configures OK, it builds, and when checking the build the check passes. This assumes that the system we used is properly set up.
  • light green -- the cpu type is "faked" , same as green but the cpu detection can't be tested and the use of instruction extensions ie AVX on a non-AVX cpu
  • orange -- some issue with this command: make tune or some other minor thing 
  • red -- a more serious failure with MPIR. This assumes that the system used is sane and all relevant environment variables are set up properly.

























If you can help us add to this list by testing MPIR on a regular basis on machines you have access to, please let us know on our development list.

About MPIR

MPIR is an open source multiprecision integer (bignum) library forked from the GMP (GNU Multi Precision) project. It consists of much code from past GMP releases, in combination with much original contributed code. A brief introduction can be found here Introduction(French)

MPIR is constructed by a developer and vendor friendly community of professional and amateur mathematicians, computer scientists and hobbyists.

The primary goals of the MPIR project are:

  • To have a developer friendly community.
  • To foster links with hardware and software vendors.
  • Development of parallel algorithms for multiprecision arithmetic including support for GPU's and other multicore processors.
  • To provide build support out-of-the-box for Linux, Apple, Sun and Microsoft Windows systems.
  • To overall license the project with the GNU LGPL license.
  • To maintain full interface support with GMP - MPIR is a drop-in replacement for GMP.
  • Support for building MPIR using Microsoft Visual Studio 2010 for use in both 32-bit and 64-bit versions of Windows.


We list here the developers who have contributed code to the MPIR project (not including those who contributed to the original GMP codebase - for a full list see the AUTHORS file in the source distribution), or who have made patches available for GMP or on their websites which we have merged into the MPIR project, or who have contributed to build testing.

  • Brian Gladman - Windows MSVC port and intel format x86_64 code
  • Jason Moxham - Very significant and extensive improvements to the assembly code on numerous processors.
  • William Hart - Build system modifications and intel format x86_64 code, some work on Toom 4 and Toom 7 code, extended GCD version of Möller's fast GCD code
  • Pierrick Gaudry - AMD 64 assembly support
  • Gonzalo Tornaria - Patches to config.guess, cpuid.c and help with build testing
  • Jason Worth Martin - Core 2 assembly support, merge of Möller's GCD patches
  • Michael Abshoff - Build system patches, valgrinding, build testing
  • Niels Möller - Fast GCD patches
  • Burcin Erocal - help with build testing on Pentium-D
  • Mariah Lennox - improvements to mpirbench and help with build testing on numerous systems, maintenance of a build farm including installing compiler snapshots
  • Marco Bodrato and Paul Zimmermann - implementations of Toom 4 and Toom 7.
  • William Stein - build testing on certain platforms
  • Jeff Gilchrist - build testing on Windows
  • David Kirkby - Build testing on Sun servers
  • Case van Horsen - Build testing on MinGW and Cygwin
  • Anonymous Japanese contributor - assembly code improvements
  • Marshall Hampton - reported a build issue on recent apple machines
  • Robert Gerbicz - Fast root detection, factorial and binomial coefficient computation
  • David Harvey - Middle product and divide and conquer approximate quotient (see release notes for MPIR 1.3 here for details).
  • Paul Zimmermann - Multiple precision inversion code for computing precomputed inverses
  • Paul Zimmermann, Pierrick Gaudry, Alexander Kruppa, Torbjorn Granlund - new FFT code (see release notes for MPIR 1.2 here for details).
  • Peter Shrimpton - BPSW primality test code for integers up to GMP_LIMB_BITS
  • T.R.Nicely - Primality test code used in the MPIR benchmark program
  • Minh Van Nguyen - served as release manager for MPIR 2.1.0


MPIR is overall licensed "LGPL version 3 (or at the user's option any later version of the license)". (Version 1.3.x of MPIR are licensed v2+ and this release series is considered very stable). In order to contribute to MPIR, developers are kindly requested to license their code in a manner compatible with this overall v3+ license. Versions of MPIR up to 1.2.2 inadvertently contained an LGPL v3+ file. Please distribute these versions of the library under the terms of the LGPL v3. We provide an LGPL v2.1+ version of the file, here, which you can substitute.

Note, it is not necessary to assign copyright to the Free Software Foundation in order to contribute to MPIR.

Development List

Most of our development gets discussed on our Google development list. Please feel free to join us, or just hang out.

Development list: mpir-devel  Note: You will not be able to post to this list unless you join the list , see Report a bug

A git repository is available at:

Instructions for contributing using Git can be found in this thread on our development list:

MPIR Git repository -- corrected

Development ideas

There are a number of important development directions for MPIR at present:

  • Speed up our division code, including exact division, newton iteration, division by double limbs.
  • Parallel processing, including CUDA development and OpenMP pragmas.
  • Optimize the mpn_nhgcd2 function in the mpn/nhgcd2.c file.
  • Speed up our root extraction/testing code, especially cube root.
  • Assembly support for Itanium, recent Sparc chips and MIPS.

If you would like to help out, please talk to us on our development list.

Here we provide a list of development ideas:

MPIR development projects.

Report a bug

The developers are pleased to hear about every and any bug. The best way to report a bug is to post to our development list (but you will have to join first) , or if you prefer, you can email a report to thempirteam. Please include as much detail as you can, including hardware, CPU, operating system, the output of config.guess (if relevant) and any other detail you think will help us, including exact error messages as reported.

Vendor support

MPIR is happy to acknowledge the ongoing support of sponsors who provide us with access to a hardware build farm and a part time person who assists us with infrastructure and build issues.

The MPIR project is happy to receive future support in the form of hardware, patches or finance from software and hardware vendors and other interested parties. We'd be happy to take enquiries on our development list, or thempirteam would be happy to act as a contact by email.

We are also happy to take enquiries regarding targeted development of MPIR. Note that any commercial improvements of MPIR must be contributed back to the project as Open Source. Contact us for further details.