Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Implementation of Float128 type

Overloading template functions with float128_t
Exponential function
typeinfo

Since few compilers implement 128-bit floating-point, and the language features like 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.

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, use -std=gnu++11 explicitly, and do not use -std=stdc++11, and do not use any 'strict' options.

The __float128 type is provided by the libquadmath library.

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.


PrevUpHomeNext