// Copyright John Maddock 2006. // Copyright Paul A. Bristow 2007, 2009 // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error #include #define BOOST_TEST_MAIN #include #include #include #include #include #include #include #include "libs/math/test/functor.hpp" #include "libs/math/test/handle_test_result.hpp" #include "../table_type.hpp" #ifndef SC_ #define SC_(x) static_cast::type>(BOOST_JOIN(x, L)) #endif template void do_test_gamma(const T& data, const char* type_name, const char* test_name) { typedef typename T::value_type row_type; typedef Real value_type; typedef value_type (*pg)(value_type); #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) pg funcp = boost::math::tgamma; #else pg funcp = boost::math::tgamma; #endif boost::math::tools::test_result result; std::cout << "Testing " << test_name << " with type " << type_name << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; // // test tgamma against data: // result = boost::math::tools::test_hetero( data, bind_func(funcp, 0), extract_result(1)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma", test_name); // // test lgamma against data: // #if defined(BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS) funcp = boost::math::lgamma; #else funcp = boost::math::lgamma; #endif result = boost::math::tools::test_hetero( data, bind_func(funcp, 0), extract_result(2)); handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::lgamma", test_name); std::cout << std::endl; } template void test_gamma(T, const char* name) { #include "gamma.ipp" do_test_gamma(gamma, name, "random values"); #include "gamma_1_2.ipp" do_test_gamma(gamma_1_2, name, "Values near 1 and 2"); #include "gamma_0.ipp" do_test_gamma(gamma_0, name, "Values near 0"); #include "gamma_neg.ipp" do_test_gamma(gamma_neg, name, "Negative arguments"); }