Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Floating-point Types

cpp_bin_float
cpp_dec_float
gmp_float
mpfr_float
float128
Examples
Construction from Specific Values Without Precision Loss
Area of Circle
Drop-in Caveats
Defining a Special Function.
Calculating a Derivative
Calculating an Integral
Polynomial Evaluation
Variable-Precision Newton Evaluation
Gauss-Laguerre quadrature

The following back-ends provide floating-point arithmetic:

Backend Type

Header

Radix

Dependencies

Pros

Cons

cpp_bin_float<N>

boost/multiprecision/cpp_bin_float.hpp

2

None

Header only, all C++ implementation. Boost licence.

Approximately 2x slower than the MPFR or GMP libraries.

cpp_dec_float<N>

boost/multiprecision/cpp_dec_float.hpp

10

None

Header only, all C++ implementation. Boost licence.

Approximately 2x slower than the MPFR or GMP libraries.

mpf_float<N>

boost/multiprecision/gmp.hpp

2

GMP

Very fast and efficient back-end.

Dependency on GNU licensed GMP library.

mpfr_float<N>

boost/multiprecision/mpfr.hpp

2

GMP and MPFR

Very fast and efficient back-end, with its own standard library implementation.

Dependency on GNU licensed GMP and MPFR libraries.

float128

boost/multiprecision/float128.hpp

2

Either libquadmath or the Intel C++ Math library.

Very fast and efficient back-end for 128-bit floating-point values (113-bit mantissa, equivalent to FORTRAN's QUAD real)

Depends on the compiler being either recent GCC or Intel C++ versions.


PrevUpHomeNext