Skip to content

Replace gmpxx library with mpreal library based on mpfr

SUMMARY

The GMPField class is now based on the mpfr::mpreal class from the MPFR-C++ library

Motivation

The old gmpcxx library lacks some implementations, e.g. of numeric_limits. Since the GMP library also recommends to switch to the (more up-to-date) library MPFR (See https://gmplib.org/manual/Floating_002dpoint-Functions.html and https://www.mpfr.org) for floating point arithmetic, I switched the backend from GMP to MPFR. The C++ wrapper is chosen to be MPFR-C++ (http://www.holoborodko.com/pavel/mpfr/) since it is used in several other libraries, e.g. Eigen, boost::multiprecision. It can be used as a floating-point type in the Eigen linear algebra library and has much better support for std::numeric_limits.

Since in the Dune GMPField implementation, the precision is given by a template parameter, some numeric_limits constants can be filled with concrete values.

Discussion

I have not changed the name of the Dune wrapper GMPField since, at the end, it is also related to the GMP library. It could be discussed whether it is better to change the name, e.g.

  • MPFRField
  • MPField
  • MPFloat
  • MultiPrecision
  • FloatMP
  • FloatMultiPrecision

or something similar.

Decision: We use the old name GMPField.

The MPFR and MPFR-C++ library are available in the Ubuntu and Debian repositories (libmpfr-dev and libmpfrc++-dev).

  • Add packages for libmpfr and libmpfrc++ to docker images for the CI system.
Edited by Simon Praetorius

Merge request reports

Loading