test_1F1_regularized.cpp 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. // (C) Copyright John Maddock 2006.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #include "test_1F1_regularized.hpp"
  6. #include <boost/multiprecision/cpp_bin_float.hpp>
  7. void expected_results()
  8. {
  9. //
  10. // Define the max and mean errors expected for
  11. // various compilers and platforms.
  12. //
  13. const char* largest_type;
  14. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  15. if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
  16. {
  17. largest_type = "(long\\s+)?double|real_concept|cpp_bin_float_quad|dec_40|cpp_bin_float_double_extended";
  18. }
  19. else
  20. {
  21. largest_type = "long double|real_concept|cpp_bin_float_quad|dec_40|cpp_bin_float_double_extended";
  22. }
  23. #else
  24. largest_type = "(long\\s+)?double";
  25. #endif
  26. add_expected_result(
  27. ".*", // compiler
  28. ".*", // stdlib
  29. ".*", // platform
  30. "cpp_bin_float_quad|cpp_bin_float_double_extended", // test type(s)
  31. "Integer a values", // test data group
  32. ".*", 25000, 800); // test function
  33. add_expected_result(
  34. ".*", // compiler
  35. ".*", // stdlib
  36. ".*", // platform
  37. "cpp_bin_float_quad|cpp_bin_float_double_extended", // test type(s)
  38. "Large.*", // test data group
  39. ".*", 500000, 20000); // test function
  40. add_expected_result(
  41. ".*", // compiler
  42. ".*", // stdlib
  43. ".*", // platform
  44. "cpp_bin_float_quad|cpp_bin_float_double_extended", // test type(s)
  45. "Small.*", // test data group
  46. ".*", 2000, 200); // test function
  47. add_expected_result(
  48. ".*", // compiler
  49. ".*", // stdlib
  50. ".*", // platform
  51. "dec_40", // test type(s)
  52. "Integer a values", // test data group
  53. ".*", 12000, 800); // test function
  54. add_expected_result(
  55. ".*", // compiler
  56. ".*", // stdlib
  57. ".*", // platform
  58. "dec_40", // test type(s)
  59. "Large.*", // test data group
  60. ".*", 200000000L, 20000000L); // test function
  61. add_expected_result(
  62. ".*", // compiler
  63. ".*", // stdlib
  64. ".*", // platform
  65. "dec_40", // test type(s)
  66. "Small.*", // test data group
  67. ".*", 1000, 300); // test function
  68. #if (LDBL_MANT_DIG < DBL_MANT_DIG * 2) && (LDBL_MANT_DIG != DBL_MANT_DIG)
  69. //
  70. // long double has only a little extra precision and errors may creep
  71. // into the double results:
  72. //
  73. add_expected_result(
  74. ".*", // compiler
  75. ".*", // stdlib
  76. ".*", // platform
  77. "double", // test type(s)
  78. "Integer a values", // test data group
  79. ".*", 5, 3); // test function
  80. add_expected_result(
  81. ".*", // compiler
  82. ".*", // stdlib
  83. ".*", // platform
  84. "double", // test type(s)
  85. "Small.*", // test data group
  86. ".*", 5, 3); // test function
  87. add_expected_result(
  88. ".*", // compiler
  89. ".*", // stdlib
  90. ".*", // platform
  91. "double", // test type(s)
  92. "Large.*", // test data group
  93. ".*", 100, 20); // test function
  94. add_expected_result(
  95. ".*", // compiler
  96. ".*", // stdlib
  97. ".*", // platform
  98. "double", // test type(s)
  99. "Bug.*", // test data group
  100. ".*", 300, 50); // test function
  101. #endif
  102. add_expected_result(
  103. ".*", // compiler
  104. ".*", // stdlib
  105. ".*", // platform
  106. largest_type, // test type(s)
  107. "Integer a values", // test data group
  108. ".*", 16000, 600); // test function
  109. add_expected_result(
  110. ".*", // compiler
  111. ".*", // stdlib
  112. ".*", // platform
  113. largest_type, // test type(s)
  114. "Small.*", // test data group
  115. ".*", 2000, 200); // test function
  116. add_expected_result(
  117. ".*", // compiler
  118. ".*", // stdlib
  119. ".*", // platform
  120. largest_type, // test type(s)
  121. "Large.*", // test data group
  122. ".*", 400000, 8000); // test function
  123. add_expected_result(
  124. ".*", // compiler
  125. ".*", // stdlib
  126. ".*", // platform
  127. "dec_40", // test type(s)
  128. "Bug cases.*", // test data group
  129. ".*", 2200000, 400000); // test function
  130. add_expected_result(
  131. ".*", // compiler
  132. ".*", // stdlib
  133. ".*", // platform
  134. largest_type, // test type(s)
  135. "Bug cases.*", // test data group
  136. ".*", 1500000, 400000); // test function
  137. //
  138. // Finish off by printing out the compiler/stdlib/platform names,
  139. // we do this to make it easier to mark up expected error rates.
  140. //
  141. std::cout << "Tests run with " << BOOST_COMPILER << ", "
  142. << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
  143. }
  144. BOOST_AUTO_TEST_CASE( test_main )
  145. {
  146. expected_results();
  147. BOOST_MATH_CONTROL_FP;
  148. #if !defined(TEST) || (TEST == 1)
  149. test_hypergeometric_mellin_transform<double>();
  150. test_hypergeometric_laplace_transform<double>();
  151. #endif
  152. #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
  153. #if !defined(TEST) || (TEST == 2)
  154. test_spots(0.0F, "float");
  155. #endif
  156. #endif
  157. #if !defined(TEST) || (TEST == 3)
  158. test_spots(0.0, "double");
  159. #endif
  160. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  161. #if (!defined(TEST) || (TEST == 4)) && (DBL_MAX_EXP != LDBL_MAX_EXP)
  162. test_spots(0.0L, "long double");
  163. #endif
  164. #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
  165. #if !defined(TEST) || (TEST == 5)
  166. test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
  167. #endif
  168. #endif
  169. #endif
  170. #if !defined(TEST) || (TEST == 6)
  171. test_spots(boost::multiprecision::cpp_bin_float_quad(), "cpp_bin_float_quad");
  172. #endif
  173. #if !defined(TEST) || (TEST == 7)
  174. typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<40> > dec_40;
  175. test_spots(dec_40(), "dec_40");
  176. #endif
  177. }