Welcome to mp++’s documentation!

mp++ is a C++11/14/17 library for multiprecision arithmetic, currently featuring:

  • arbitrary-precision integers,
  • arbitrary-precision rationals,
  • arbitrary-precision floats,
  • quadruple-precision floats.

Design goals include:

  • excellent performance for small integer and rational operands,
  • easy embeddability in computer algebra systems and generic C++ libraries,
  • a large collection of arbitrary-precision special functions.

Design non-goals include:

Based on well-known libraries such as GMP, MPFR, and others, mp++ was initially conceived as a GMP wrapper with a special focus on performance with small operands. In particular, a small buffer optimisation and custom implementations of basic mathematical primitives are instrumental in achieving a performance increase, with respect to GMP and other integer multiprecision libraries, which can be substantial (see the benchmarks section).

Eventually, a multiprecision rational class and two multiprecision floating-point classes were added, and today a secondary objective of mp++ is to provide a modern, consistent and unified C++ interface to several lower-level multiprecision libraries.

mp++ is a spinoff of the Piranha library, released under the MPL2 license.

If you are using mp++ as part of your research, teaching, or other activities, we would be grateful if you could star the repository and/or cite our work. The DOI of the latest version and other citation resources are available at this link.

Warning

mp++ is under active development, and, although we try not to break the API gratuitously, backwards-incompatible changes do happen from time to time. The API will be stabilised with the upcoming release of version 1.0.

Note

This documentation refers to the latest development version of mp++, and it may describe features not yet available in mp++’s stable releases.