1 // Copyright John Maddock 2006.
2 // Copyright Paul A. Bristow 2007, 2009
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
9 #include <boost/math/concepts/real_concept.hpp>
10 #include <boost/math/special_functions/math_fwd.hpp>
11 #define BOOST_TEST_MAIN
12 #include <boost/test/unit_test.hpp>
13 #include <boost/test/tools/floating_point_comparison.hpp>
14 #include <boost/math/tools/stats.hpp>
15 #include <boost/math/tools/test.hpp>
16 #include <boost/math/tools/big_constant.hpp>
17 #include <boost/math/constants/constants.hpp>
18 #include <boost/type_traits/is_floating_point.hpp>
19 #include <boost/array.hpp>
20 #include "functor.hpp"
22 #include "handle_test_result.hpp"
23 #include "table_type.hpp"
25 #include <boost/math/special_functions/hypergeometric_2F0.hpp>
27 template <class Real, class T>
28 void do_test_2F0(const T& data, const char* type_name, const char* test_name)
30 typedef Real value_type;
32 typedef value_type(*pg)(value_type, value_type, value_type);
33 #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS)
34 pg funcp = boost::math::hypergeometric_0F1<value_type, value_type>;
36 pg funcp = boost::math::hypergeometric_2F0;
39 boost::math::tools::test_result<value_type> result;
41 std::cout << "Testing " << test_name << " with type " << type_name
42 << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
45 // test hypergeometric_2F0 against data:
47 result = boost::math::tools::test_hetero<Real>(
49 bind_func<Real>(funcp, 0, 1, 2),
50 extract_result<Real>(3));
51 handle_test_result(result, data[result.worst()], result.worst(), type_name, "hypergeometric_0F1", test_name);
52 std::cout << std::endl;
56 #define SC_(x) BOOST_MATH_BIG_CONSTANT(T, 1000000, x)
60 void test_spots1(T, const char* type_name)
62 #include "hypergeometric_2F0.ipp"
64 do_test_2F0<T>(hypergeometric_2F0, type_name, "Random non-integer a2, |z| < 1");
66 #include "hypergeometric_2F0_large_z.ipp"
68 do_test_2F0<T>(hypergeometric_2F0_large_z, type_name, "Random non-integer a2, |z| > 1");
72 void test_spots2(T, const char* type_name)
74 #include "hypergeometric_2F0_integer_a2.ipp"
76 do_test_2F0<T>(hypergeometric_2F0_integer_a2, type_name, "Integer a2, |z| > 1");
78 #include "hypergeometric_2F0_half.ipp"
80 do_test_2F0<T>(hypergeometric_2F0_half, type_name, "a1 = a2 + 0.5");
84 void test_spots(T z, const char* type_name)
86 test_spots1(z, type_name);
87 test_spots2(z, type_name);
92 if (std::numeric_limits<T>::has_infinity)
94 BOOST_CHECK((boost::math::isinf)(boost::math::hypergeometric_2F0(a1, a2, z)));
96 BOOST_CHECK((boost::math::isinf)(boost::math::hypergeometric_2F0(a1, a2, z)));
98 BOOST_CHECK((boost::math::isinf)(boost::math::hypergeometric_2F0(a1, a2, z)));
100 BOOST_CHECK((boost::math::isinf)(boost::math::hypergeometric_2F0(a1, a2, z)));