]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/multiprecision/test/test_cos.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / multiprecision / test / test_cos.cpp
index ee48a85cb651312323a1eb64fbb17d7486a1e491..5d534cf6befa64dc606dd2bab5017c56141a14b9 100644 (file)
 #include <boost/multiprecision/cpp_bin_float.hpp>
 #endif
 
+template <class T>
+struct has_poor_large_value_support
+{
+   static const bool value = false;
+};
+#ifdef TEST_CPP_DEC_FLOAT
+template <unsigned Digits10, class ExponentType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct has_poor_large_value_support<boost::multiprecision::number<boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>, ExpressionTemplates> >
+{
+   static const bool value = true;
+};
+#endif
+#ifdef TEST_CPP_BIN_FLOAT
+template<unsigned Digits, boost::multiprecision::backends::digit_base_type DigitBase, class Allocator, class Exponent, Exponent MinE, Exponent MaxE, boost::multiprecision::expression_template_option ExpressionTemplates>
+struct has_poor_large_value_support<boost::multiprecision::number<boost::multiprecision::cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>, ExpressionTemplates> >
+{
+   static const bool value = true;
+};
+#endif
+
 template <class T>
 void test()
 {
@@ -313,6 +333,15 @@ void test()
    }
    std::cout << "Max error was: " << max_err << std::endl;
    BOOST_TEST(max_err < 20);
+
+   if (has_poor_large_value_support<T>::value)
+   {
+      T bug_value = 12 / std::numeric_limits<T>::epsilon();
+      for (unsigned i = 0; i < 20; ++i, bug_value *= 1.1)
+      {
+         BOOST_TEST(cos(bug_value) == 1);
+      }
+   }
 }