-
__float128 is the compiler supplied hardware type, it's an C-ish extension
to C++ and there is only minimal support for it in normal C++ (no IO streams
or
numeric_limits support,
function names in libquadmath all have different names to the std::
ones etc.) So you can program that type directly but it's harder work.
-
Type float128 is a thin wrapper around __float128 and makes it C++ and
generic code friendly.
-
Make sure you declare variables with the correct type, here
float128.
-
Make sure that if you pass a variable to a function then it is casted to
float128.
-
Make sure you declare literals with the correct suffix - otherwise they'll
be treated as type
double
with catastrophic loss of precision. So make sure they have a Q suffix
for 128-bit floating-point literals.
-
All the std library functions, cmath functions, plus all the constants,
and special functions from Boost.Math should then just work.
-
Make sure std lib functions are called unqualified
so that the correct overload is found via Argument
Dependent Lookup (ADL). So write sqrt(variable) and not std::sqrt(variable).
-
In general, try not to reinvent stuff - using constants from Boost.Math
is probably less error prone than declaring your own, likewise the special
functions etc.
Some examples of what can go horribly and silently wrong are at float128_example.cpp.