]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/test/test_1F0.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / math / test / test_1F0.hpp
CommitLineData
92f5a8d4
TL
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)
6
7#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
8
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/constants/constants.hpp>
17#include <boost/type_traits/is_floating_point.hpp>
18#include <boost/array.hpp>
19#include "functor.hpp"
20
21#include "handle_test_result.hpp"
22#include "table_type.hpp"
23
24#include <boost/math/special_functions/hypergeometric_1F0.hpp>
25
26#ifndef SC_
27#define SC_(x) static_cast<typename table_type<T>::type>(BOOST_JOIN(x, L))
28#endif
29
30
31template <class T>
32void test_spots(T)
33{
34 using std::pow;
35 //
36 // basic sanity checks, tolerance is 10 epsilon expressed as a percentage:
37 //
38 T tolerance = boost::math::tools::epsilon<T>() * 1000;
39
40 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(-3), T(2)), T(-1), tolerance);
41 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(-3), T(4)), T(-27), tolerance);
42 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(-3), T(0.5)), T(0.125), tolerance);
43 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(3), T(0.5)), T(8), tolerance);
44 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(3), T(2)), T(-1), tolerance);
45 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(3), T(4)), T(T(-1) / 27), tolerance);
46 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(3), T(-0.5)), pow(T(1.5), -3), tolerance);
47 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(3), T(-2)), T(1 / T(27)), tolerance);
48 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(3), T(-4)), T(T(1) / 125), tolerance);
49 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(-3), T(-0.5)), pow(T(1.5), 3), tolerance);
50 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(-3), T(-2)), T(27), tolerance);
51 BOOST_CHECK_CLOSE(boost::math::hypergeometric_1F0(T(-3), T(-4)), T(125), tolerance);
52
53 BOOST_CHECK_THROW(boost::math::hypergeometric_1F0(T(3), T(1)), std::domain_error);
54 BOOST_CHECK_THROW(boost::math::hypergeometric_1F0(T(-3), T(1)), std::domain_error);
55 BOOST_CHECK_THROW(boost::math::hypergeometric_1F0(T(3.25), T(1)), std::domain_error);
56 BOOST_CHECK_THROW(boost::math::hypergeometric_1F0(T(-3.25), T(1)), std::domain_error);
57 BOOST_CHECK_THROW(boost::math::hypergeometric_1F0(T(3.25), T(2)), std::domain_error);
58 BOOST_CHECK_THROW(boost::math::hypergeometric_1F0(T(-3.25), T(2)), std::domain_error);
59}
60