GMPdotNet can be downloaded from:

GMPdotNet is a .Net wrapper for the GNU MP big-number math library (  It includes support for big integers, arbitrary-precision floating-point numbers, and rational numbers.  GNU MP is a very fast big-number library, and is the most common open source big-number library.

The PI calculator included in GMPdotNet is a very fast C# PI calculator.

The binary packages are built for .Net-2.0 and later, on Windows 2000 and later.  If you compile from source without modifying the project files, it will require .Net-3.5. (Build files are included to ease VS2005/.Net-2.0 builds.)

The GMP libraries were built from the "gmp4win" project/solution files from Brian Gladman, available at: They were tweaked slightly to build on VC Express 2005 (in order to facilitate .Net-2.0), but are otherwise unchanged.  The exact source / binary GMP packages used are available from the gmp-win32-bin project page.

Version 0.1 includes support for all the C functions that do not require varargs.  Currently, the unsupported varargs functions are: "gmp_randinit", "gmp_asprintf", "gmp_printf", "gmp_snprintf", "gmp_sprintf", "gmp_scanf", and "gmp_sscanf".  All other C functions are wrapped.

Version 0.1 includes support for C++-style math operators, which work the same as "gmpxx" (and which use gmpxx for their implementation).  Note that some of the efficiency provided by gmpxx does not translate well into wrappers; in particular, "c = a + b" does result in the creation of a new variable in GMPdotNet, but usually does not create new variables nor use temporaries in gmpxx.

Most people will probably find it best to use the standard C++-style operators for most operations, but use the C wrapper functions inside tight loops.  This is what PI-CSharp does.

The classes are named "GMPInteger", "GMPFloat", "GMPRational", and "GMPRandomNumber", but otherwise exactly map to "mpz_class", "mpf_class", "mpq_class", and "gmp_randclass" respectively.

Bugs can be reported to "".

Enjoy your math.