#include #include typedef boost::multiprecision::number > boost_float128_t; typedef boost::multiprecision::number > boost_float256_t; int main(int , char** ) { boost_float128_t a = 1; boost_float128_t b = ldexp(boost_float128_t(0.99), -128); boost_float128_t c = a - b; boost_float128_t d = boost_float128_t(boost_float256_t(a) - boost_float256_t(b)); std::cout << std::setprecision(40) << std::scientific << "a = " << a << "\n" << "b = " << b << "\n" << "c = " << c << " (a - b)\n" << "d = " << d << " (a - b) calculated with 256-bit precision.\n" ; if (c == d) std::cout << "o.k\n"; else std::cout << "fail.\n"; return 0; }