boost/libs/multiprecision/test/test_mixed_cpp_bin_float.cpp

42 lines
1.5 KiB
C++
Raw Permalink Normal View History

2018-01-12 21:47:58 +01:00
///////////////////////////////////////////////////////////////
// Copyright 2012 John Maddock. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
2021-10-05 21:37:46 +02:00
// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
2018-01-12 21:47:58 +01:00
#ifdef _MSC_VER
2021-10-05 21:37:46 +02:00
#define _SCL_SECURE_NO_WARNINGS
2018-01-12 21:47:58 +01:00
#endif
#include <boost/multiprecision/cpp_bin_float.hpp>
#include "test_mixed.hpp"
int main()
{
#ifndef BOOST_NO_EXCEPTIONS
2021-10-05 21:37:46 +02:00
try
{
2018-01-12 21:47:58 +01:00
#endif
2021-10-05 21:37:46 +02:00
typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<100>, boost::multiprecision::et_on> big_type1;
typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<50>, boost::multiprecision::et_on> small_type1;
2018-01-12 21:47:58 +01:00
typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<100>, boost::multiprecision::et_off> big_type2;
2021-10-05 21:37:46 +02:00
typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<50>, boost::multiprecision::et_off> small_type2;
2018-01-12 21:47:58 +01:00
test<big_type1, small_type1>();
test<big_type2, small_type2>();
test<big_type1, small_type2>();
test<big_type2, small_type1>();
2021-10-05 21:37:46 +02:00
typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<100, boost::multiprecision::digit_base_10, std::allocator<char> >, boost::multiprecision::et_on> big_type1a;
test<big_type1, big_type1a>();
2018-01-12 21:47:58 +01:00
#ifndef BOOST_NO_EXCEPTIONS
}
2021-10-05 21:37:46 +02:00
catch (const std::exception& e)
2018-01-12 21:47:58 +01:00
{
std::cout << "Failed with unexpected exception: " << e.what() << std::endl;
return 1;
}
#endif
return boost::report_errors();
}