# mp++¶

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

arbitrary-precision integers,

arbitrary-precision rationals,

quadruple-precision floats,

quadruple-precision complex numbers,

arbitrary-precision floats,

arbitrary-precision complex numbers.

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,

an ergonomic API based on modern C++ idioms.

Design non-goals include:

support for fixed-size wide integrals (i.e., no

`uint512_t`

, try Boost Multiprecision instead).

Built on top of the GNU multiprecision stack (GMP, MPFR, MPC), mp++ was initially conceived as a GMP wrapper with 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).

Over time, mp++ has accrued many additional features, including multiprecision real and complex number types, and an expanding library of special functions (built in part on top of the excellent Arb library).

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.

- Installation
- Tutorial
- Preliminaries
- Construction, conversion and assignment
- Input and output
- The numerical tower and type coercion
- Common operators
- API overview
- Integer tutorial
- Rational tutorial
- Quadruple-precision float tutorial
- Quadruple-precision complex numbers tutorial
- Multiprecision float tutorial
- Multiprecision complex numbers tutorial
- Boost.serialization support
- Extra: integration with pybind11

- Reference
- Benchmarks
- Changelog
- 0.22 (2021-01-03)
- 0.21 (2020-06-17)
- 0.20 (2020-06-03)
- 0.19 (2020-02-29)
- 0.18 (2020-02-14)
- 0.17 (2019-09-13)
- 0.16 (2019-05-25)
- 0.15 (2019-05-24)
- 0.14 (2019-04-11)
- 0.13 (2019-03-13)
- 0.12 (2018-10-11)
- 0.11 (2018-05-22)
- 0.10 (2018-04-06)
- 0.9 (2018-02-25)
- 0.8 (2018-01-26)
- 0.7 (2018-01-11)
- 0.6 (2017-12-05)
- 0.5 (2017-11-07)
- 0.4 (2017-07-29)
- 0.3 (2017-06-12)
- 0.2 (2017-05-09)