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 5 // 6 7 #ifdef _MSC_VER 8 #define _SCL_SECURE_NO_WARNINGS 9 #endif 10 11 #include <boost/detail/lightweight_test.hpp> 12 #include <boost/array.hpp> 13 #include "test.hpp" 14 15 #include <boost/multiprecision/cpp_dec_float.hpp> 16 main()17int main() 18 { 19 using namespace boost::multiprecision; 20 // 21 // Test interconversions between different precisions: 22 // 23 cpp_dec_float_50 f1(2); 24 cpp_dec_float_100 f2(3); 25 26 cpp_dec_float_100 f3 = f1; // implicit conversion OK 27 BOOST_TEST(f3 == 2); 28 cpp_dec_float_50 f4(f2); // explicit conversion OK 29 BOOST_TEST(f4 == 3); 30 31 f2 = f1; 32 BOOST_TEST(f2 == 2); 33 f2 = 4; 34 f1 = static_cast<cpp_dec_float_50>(f2); 35 BOOST_TEST(f1 == 4); 36 37 return boost::report_errors(); 38 } 39