About Me
Background
Policy Analysis
Organisations
Cryptography
Technology
Cryptography
Computing
Mathematics
Papers

NO2ID - Stop ID cards and the database state

Multiple Precision Arithmetic on Windows

The Gnu GMP multiple precision library available here is widely recognised as the library of choice for multiple precision integer arithmetic in C.    It is licensed under LGPL terms and is now the core arithmetic library used by a number of commercial symbolic maths packages including Mathematica and Maple.   A version of GMP is also used by Sage, the open source symbolic maths package.

GMP achieves its performance by providing fast machine specific assembler code for many widely used processors

Multiple Precision Integers and Rationals - MPIR

MPIR is a Windows friendly port of GMP that is available here.   As a library, MPIR is compatible with GMP and supports native Windows builds using Microsoft Visual Studio 2008 Professional with the open source YASM assembler.    It can also be built using Visual Studio 2008 Express C++ SP1 and Visual Studio 2005.  It provides 32 and 64-bit static and dynamic libraries and has high performance assembler code support for AMD and Intel 64-bit processors.    MPIR also fully supports Windows x64 exception handling mechanisms.

In contrast with GMP, the MPIR community welcomes native Windows development using the Microsoft Visual Studio IDE.  Although many on the MPIR development team are dedicated Linux/GCC users, they are not hostile to native Windows development and have welcomed and supported the contributions of myself and others who work on the Windows platform. 

MPFR on Windows

MPFR is a high quality multiple precision floating point library provided here.    It works with GMP but it is equally capable of working with MPIR. 

I provide Visual Studio 2008 project build files for MPFR running on top of MPIR here.   Full support is provided for both 32 and 64 bit static and dynamic libraries.

MPC on Windows

MPC is a multiple precision floating point library for complex numbers built on top of MPFR and GMP or MPIR.  This ZIP file contains an  initial Visual Studio 2008 build project for MPC.  It offers win32 and x64 builds for both static and dynamic libraries.

 The MPC-0.8 directory should be renamed to MPC so that the zip file expands into this directory, after which the build project mpc.sln should be found in the build.vc9 subdirectory.

GMP on Microsoft Windows

MPIR exists in part because Torbjörn Granlund, the GMP maintainer, refuses to support Microsoft Visual Studio build capabilities for GMP.  Although MPIR is the obvious choice on Windows, people who still wish to use GMP do have several options:

Projects that need 32-bit versions of the GMP library can use either MinGW or Cygwin to build their applications.

It is reported that the resulting libraries can also be used to build 32-bit applications with Microsoft Visual Studio.

Native 64-bit versions of the GMP library are not officially available but it is now possible to build 64-bit GMP libraries for Windows with mingw-w64 by making use of GMP's generic C code.  This should allow Windows 64-bit GMP based applications to be built with mingw-w64.

It is unlikely that the resulting libraries can be directly used with Microsoft Visual Studio.  Nevertheless, it may be possible to convert them for such use with Agner Fog's excellent objconv utility.

GMP cannot, however, provide high performance 64-bit libraries on Windows because its 64-bit assembler code is incompatible with Windows x64 calling conventions. This means that 64-bit GMP libraries on WIndows are very slow when compared with MPIR, which has excellent 64-bit assembler support.

Acknowledgements

My thanks go to:

  1. Torbjörn Granlund and other GMP contributors for making this library available.
  2. Patrick Pelissier, Vincent Lefevre and Paul Zimmermann (the MPFR team) for making their library available and for helping its Windows users.
  3. The MPIR team for their support and encouragement.
  4. The Intel compiler support team for helping with some conversion issues.

Back to Brian Gladman's Home Page