/////////////////////////////////////////////////////////////////////////////// // Copyright 2013 John Maddock. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #define BOOST_TEST_MODULE multiprecision #include BOOST_AUTO_TEST_CASE(multiprecision) { using namespace boost::multiprecision; cpp_dec_float_50 a(0), b(0), c(1); cpp_dec_float_50 eps = std::numeric_limits::epsilon(); BOOST_CHECK_EQUAL(a, b); BOOST_CHECK_NE(a, c); BOOST_CHECK_LE(a, b); BOOST_CHECK_GE(a, b); BOOST_CHECK_GT(c, a); BOOST_CHECK_LT(a, c); BOOST_CHECK_SMALL(a, eps); BOOST_CHECK_SMALL(eps/2, eps); b = c + 10 * eps; BOOST_CHECK_CLOSE_FRACTION(b, c, eps * 20); BOOST_CHECK_CLOSE(b, c, eps * 20 * 100); BOOST_CHECK_CLOSE_FRACTION(1 * b, c, eps * 20); BOOST_CHECK_CLOSE(1 * b, c, eps * 20 * 100); }