]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/math/test/test_trapezoidal.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / test / test_trapezoidal.cpp
index c99d9208e84530c3ed82d1e96a096e9a9381e97b..4a2ce2cd1870f5be8959165a5a2732b015c76d41 100644 (file)
@@ -11,6 +11,7 @@
 //#include <boost/multiprecision/mpc.hpp>
 #include <boost/test/included/unit_test.hpp>
 #include <boost/test/tools/floating_point_comparison.hpp>
+#include <boost/math/tools/test_value.hpp>
 #include <boost/math/concepts/real_concept.hpp>
 #include <boost/math/special_functions/bessel.hpp>
 #include <boost/math/quadrature/trapezoidal.hpp>
@@ -52,8 +53,8 @@ void test_complex_bessel()
     // N[BesselJ[2, 2 + 3 I], 143]
     // 1.257674591970511077630764085052638490387449039392695959943027966195657681586539389134094087028482099931927725892... +
     // 2.318771368505683055818032722011594415038779144567369903204833213112457210243098545874099591376455981793627257060... i
-    Real Jnzx = boost::lexical_cast<Real>("1.257674591970511077630764085052638490387449039392695959943027966195657681586539389134094087028482099931927725892");
-    Real Jnzy = boost::lexical_cast<Real>("2.318771368505683055818032722011594415038779144567369903204833213112457210243098545874099591376455981793627257060");
+    Real Jnzx = BOOST_MATH_TEST_VALUE(Real, 1.257674591970511077630764085052638490387449039392695959943027966195657681586539389134094087028482099931927725892);
+    Real Jnzy = BOOST_MATH_TEST_VALUE(Real, 2.318771368505683055818032722011594415038779144567369903204833213112457210243098545874099591376455981793627257060);
     Real tol = 10*std::numeric_limits<Real>::epsilon();
     BOOST_CHECK_CLOSE_FRACTION(Jnz.real(), Jnzx, tol);
     BOOST_CHECK_CLOSE_FRACTION(Jnz.imag(), Jnzy, tol);
@@ -81,8 +82,8 @@ void test_I0_complex()
     // N[BesselI[0, 2 + 3 I], 143]
     // -1.24923487960742219637619681391438589436703710701063561548156438052154090067526565701278826317992172207565649925713468090525951417141982808439560899101
     // 0.947983792057734776114060623981442199525094227418764823692296622398838765371662384207319492908490909109393495109183270208372778907692930675595924819922 i
-    Real I0zx = boost::lexical_cast<Real>("-1.24923487960742219637619681391438589436703710701063561548156438052154090067526565701278826317992172207565649925713468090525951417141982808439560899101");
-    Real I0zy = boost::lexical_cast<Real>("0.947983792057734776114060623981442199525094227418764823692296622398838765371662384207319492908490909109393495109183270208372778907692930675595924819922");
+    Real I0zx = BOOST_MATH_TEST_VALUE(Real, -1.24923487960742219637619681391438589436703710701063561548156438052154090067526565701278826317992172207565649925713468090525951417141982808439560899101);
+    Real I0zy = BOOST_MATH_TEST_VALUE(Real, 0.947983792057734776114060623981442199525094227418764823692296622398838765371662384207319492908490909109393495109183270208372778907692930675595924819922);
     Real tol = 10*std::numeric_limits<Real>::epsilon();
     BOOST_CHECK_CLOSE_FRACTION(I0z.real(), I0zx, tol);
     BOOST_CHECK_CLOSE_FRACTION(I0z.imag(), I0zy, tol);
@@ -114,8 +115,8 @@ void test_erfc()
     // N[Erfc[2-i], 150]
     //-0.00360634272565175091291182820541914235532928536595056623793472801084629874817202107825472707423984408881473019087931573313969503235634965264302640170177
     // - 0.0112590060288150250764009156316482248536651598819882163212627394923365188251633729432967232423246312345152595958230197778555210858871376231770868078020 i
-    Real erfczx = boost::lexical_cast<Real>("-0.00360634272565175091291182820541914235532928536595056623793472801084629874817202107825472707423984408881473019087931573313969503235634965264302640170177");
-    Real erfczy = boost::lexical_cast<Real>("-0.0112590060288150250764009156316482248536651598819882163212627394923365188251633729432967232423246312345152595958230197778555210858871376231770868078020");
+    Real erfczx = BOOST_MATH_TEST_VALUE(Real, -0.00360634272565175091291182820541914235532928536595056623793472801084629874817202107825472707423984408881473019087931573313969503235634965264302640170177);
+    Real erfczy = BOOST_MATH_TEST_VALUE(Real, -0.0112590060288150250764009156316482248536651598819882163212627394923365188251633729432967232423246312345152595958230197778555210858871376231770868078020);
     Real tol = 5000*std::numeric_limits<Real>::epsilon();
     BOOST_CHECK_CLOSE_FRACTION(erfcz.real(), erfczx, tol);
     BOOST_CHECK_CLOSE_FRACTION(erfcz.imag(), erfczy, tol);
@@ -167,7 +168,7 @@ void test_bump_function()
     Real tol = boost::math::tools::epsilon<Real>();
     Real Q = trapezoidal(f, (Real) -1, (Real) 1, tol);
     // 2*NIntegrate[Exp[-(1/(1 - x^2))], {x, 0, 1}, WorkingPrecision -> 210]
-    Real Q_exp = boost::lexical_cast<Real>("0.44399381616807943782304892117055266376120178904569749730748455394704");
+    Real Q_exp = BOOST_MATH_TEST_VALUE(Real, 0.44399381616807943782304892117055266376120178904569749730748455394704);
     BOOST_CHECK_CLOSE_FRACTION(Q, Q_exp, 30*tol);
 }
 
@@ -227,60 +228,92 @@ BOOST_AUTO_TEST_CASE(trapezoidal_quadrature)
 {
     test_constant<float>();
     test_constant<double>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_constant<long double>();
+#endif
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
     test_constant<boost::math::concepts::real_concept>();
+#endif
     test_constant<cpp_bin_float_50>();
     test_constant<cpp_bin_float_100>();
 
     test_rational_periodic<float>();
     test_rational_periodic<double>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_rational_periodic<long double>();
+#endif
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
     test_rational_periodic<boost::math::concepts::real_concept>();
+#endif
     test_rational_periodic<cpp_bin_float_50>();
     test_rational_periodic<cpp_bin_float_100>();
 
     test_bump_function<float>();
     test_bump_function<double>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_bump_function<long double>();
+#endif
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
     test_rational_periodic<boost::math::concepts::real_concept>();
+#endif
     test_rational_periodic<cpp_bin_float_50>();
 
     test_zero_function<float>();
     test_zero_function<double>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_zero_function<long double>();
+#endif
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
     test_zero_function<boost::math::concepts::real_concept>();
+#endif
     test_zero_function<cpp_bin_float_50>();
     test_zero_function<cpp_bin_float_100>();
 
     test_sinsq<float>();
     test_sinsq<double>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_sinsq<long double>();
+#endif
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
     test_sinsq<boost::math::concepts::real_concept>();
+#endif
     test_sinsq<cpp_bin_float_50>();
     test_sinsq<cpp_bin_float_100>();
 
     test_slowly_converging<float>();
     test_slowly_converging<double>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_slowly_converging<long double>();
+#endif
+#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
     test_slowly_converging<boost::math::concepts::real_concept>();
+#endif
 
     test_rational_sin<float>();
     test_rational_sin<double>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_rational_sin<long double>();
+#endif
     //test_rational_sin<boost::math::concepts::real_concept>();
     test_rational_sin<cpp_bin_float_50>();
 
     test_complex_bessel<std::complex<float>>();
     test_complex_bessel<std::complex<double>>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_complex_bessel<std::complex<long double>>();
+#endif
     //test_complex_bessel<boost::multiprecision::mpc_complex_100>();
     test_I0_complex<std::complex<float>>();
     test_I0_complex<std::complex<double>>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_I0_complex<std::complex<long double>>();
+#endif
     //test_I0_complex<boost::multiprecision::mpc_complex_100>();
     test_erfc<std::complex<float>>();
     test_erfc<std::complex<double>>();
+#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
     test_erfc<std::complex<long double>>();
+#endif
     //test_erfc<boost::multiprecision::number<boost::multiprecision::mpc_complex_backend<20>>>();
     //test_erfc<boost::multiprecision::number<boost::multiprecision::mpc_complex_backend<30>>>();
     //test_erfc<boost::multiprecision::mpc_complex_50>();