1 ///////////////////////////////////////////////////////////////
2 // Copyright 2012 John Maddock. Distributed under the Boost
3 // Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
7 // Compare arithmetic results using fixed_int to GMP results.
11 #define _SCL_SECURE_NO_WARNINGS
15 #include <boost/multiprecision/gmp.hpp>
18 #include <boost/multiprecision/mpfr.hpp>
20 #include <boost/multiprecision/cpp_dec_float.hpp>
23 template <class Number, class BigNumber>
26 using namespace boost::multiprecision;
27 typedef Number test_type;
34 BOOST_CHECK_EQUAL(add(r, a, a), BigNumber(a) + BigNumber(a));
35 BOOST_CHECK_EQUAL(subtract(r, a, b), BigNumber(a) - BigNumber(b));
36 BOOST_CHECK_EQUAL(subtract(r, b, a), BigNumber(b) - BigNumber(a));
37 BOOST_CHECK_EQUAL(multiply(r, a, a), BigNumber(a) * BigNumber(a));
42 using namespace boost::multiprecision;
44 test<cpp_dec_float_50, cpp_dec_float_100>();
47 test<mpf_float_50, mpf_float_100>();
50 test<mpfr_float_50, mpfr_float_100>();
53 return boost::report_errors();