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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Implementation of Float128 type

Overloading template functions with float128_t
Exponential function

Since few compilers implement a true 128-bit floating-point, and language features like the suffix Q, and C++ Standard library functions are as-yet missing or incomplete in C++11, this Boost.Math implementation wraps __float128 provided by the GCC compiler or the _Quad type provided by the Intel compiler.

This is provided to in order to demonstrate, and users to evaluate, the feasibility and benefits of higher-precision floating-point, especially to allow use of the full Boost.Math library of functions and distributions at high precision.

(It is also possible to use Boost.Math with Boost.Multiprecision decimal and binary, but since these are entirely software solutions, allowing much higher precision or arbitrary precision, they are likely to be slower).

We also provide (we believe full) support for <limits>, <cmath>, I/O stream operations in <iostream>, and <complex>.

As a prototype for a future C++ standard, we place all these in namespace std. This contravenes the existing C++ standard of course, so selecting any compiler that promises to check conformance will fail.

[Tip] Tip

For GCC, compile with -std=gnu++11 or -std=gnu++03 and do not use -std=stdc++11or any 'strict' options as these turn off full support for __float128. These requirements also apply to the Intel compiler on Linux, for Intel on Windows you need to compile with -Qoption,cpp,--extended_float_type -DBOOST_MATH_USE_FLOAT128 in order to activate 128-bit floating point support.

The __float128 type is provided by the libquadmath library on GCC or by Intel's FORTRAN library with Intel C++.

A typical invocation of the compiler is

g++ -O3 -std=gnu++11 test.cpp -I/c/modular-boost -lquadmath -o test.exe
[Tip] Tip

If you are trying to use the develop branch of Boost.Math, then make -I/c/modular-boost/libs/math/include the first include directory.

g++ -O3 -std=gnu++11 test.cpp -I/c/modular-boost/libs/math/include -I/c/modular-boost -lquadmath -o test.exe
[Note] Note

So far, the only missing detail that we have noted is in trying to use <typeinfo>, for example for std::cout << typeid<__float_128>.name();. Link fails: undefined reference to typeinfo for __float128. See GCC Bug 43622 - no C++ typeinfo for __float128.