diff --git a/include/boost/math/special_functions/detail/polygamma.hpp b/include/boost/math/special_functions/detail/polygamma.hpp index 9c8ef2598..843e9aecb 100644 --- a/include/boost/math/special_functions/detail/polygamma.hpp +++ b/include/boost/math/special_functions/detail/polygamma.hpp @@ -145,10 +145,11 @@ } sum0 *= boost::math::factorial(n); } + else { for(int k = 1; k <= iter; ++k) { - T log_term = log(z) * minus_m_minus_one + boost::math::lgamma(n + 1, pol); + T log_term = log(z) * minus_m_minus_one + boost::math::lgamma(T(n + 1), pol); sum0 += exp(log_term); z += 1; } @@ -258,6 +259,7 @@ template T poly_cot_pi(int n, T x, T xc, const Policy& pol, const char* function) { + BOOST_MATH_STD_USING // Return n'th derivative of cot(pi*x) at x, these are simply // tabulated for up to n = 9, beyond that it is possible to // calculate coefficients as follows: @@ -275,201 +277,203 @@ // of storage space, this method has no better accuracy than recursion // on x to x > 0 when computing polygamma :-( // - T s = fabs(x) < fabs(xc) ? boost::math::sin_pi(x) : boost::math::sin_pi(xc); + T s = fabs(x) < fabs(xc) ? boost::math::sin_pi(x, pol) : boost::math::sin_pi(xc, pol); switch(n) { case 1: return -constants::pi() / (s * s); case 2: { - T c = boost::math::cos_pi(x); - return 2 * constants::pi() * constants::pi() * c / boost::math::pow<3>(s); + T c = boost::math::cos_pi(x, pol); + return 2 * constants::pi() * constants::pi() * c / boost::math::pow<3>(s, pol); } case 3: { - T c = boost::math::cos_pi(2 * x); - return -2 * boost::math::pow<3>(constants::pi()) * (c + 2) / boost::math::pow<4>(s); + T c = boost::math::cos_pi(2 * x, pol); + return -2 * boost::math::pow<3>(constants::pi(), pol) * (c + 2) / boost::math::pow<4>(s, pol); } case 4: { - T c = boost::math::cos_pi(x); - T c2 = boost::math::cos_pi(2 * x); - return 4 * boost::math::pow<4>(constants::pi()) * (c2 + 5) * c / boost::math::pow<5>(s); + T c = boost::math::cos_pi(x, pol); + T c2 = boost::math::cos_pi(2 * x, pol); + return 4 * boost::math::pow<4>(constants::pi(), pol) * (c2 + 5) * c / boost::math::pow<5>(s, pol); } case 5: { - T c2 = boost::math::cos_pi(2 * x); - T c4 = boost::math::cos_pi(4 * x); - return -2 * boost::math::pow<5>(constants::pi()) *(26 * c2 + c4 + 33) / boost::math::pow<6>(s); + T c2 = boost::math::cos_pi(2 * x, pol); + T c4 = boost::math::cos_pi(4 * x, pol); + return -2 * boost::math::pow<5>(constants::pi(), pol) *(26 * c2 + c4 + 33) / boost::math::pow<6>(s, pol); } case 6: { - T c = boost::math::cos_pi(x); - T c2 = boost::math::cos_pi(2 * x); - T c4 = boost::math::cos_pi(4 * x); - return 4 * boost::math::pow<6>(constants::pi()) * (56 * c2 + c4 + 123) * c / boost::math::pow<7>(s); + T c = boost::math::cos_pi(x, pol); + T c2 = boost::math::cos_pi(2 * x, pol); + T c4 = boost::math::cos_pi(4 * x, pol); + return 4 * boost::math::pow<6>(constants::pi(), pol) * (56 * c2 + c4 + 123) * c / boost::math::pow<7>(s, pol); } case 7: { - T c2 = boost::math::cos_pi(2 * x); - T c4 = boost::math::cos_pi(4 * x); - T c6 = boost::math::cos_pi(6 * x); - return -2 * boost::math::pow<7>(constants::pi()) * (1191 * c2 + 120 * c4 + c6 + 1208) / boost::math::pow<8>(s); + T c2 = boost::math::cos_pi(2 * x, pol); + T c4 = boost::math::cos_pi(4 * x, pol); + T c6 = boost::math::cos_pi(6 * x, pol); + return -2 * boost::math::pow<7>(constants::pi(), pol) * (1191 * c2 + 120 * c4 + c6 + 1208) / boost::math::pow<8>(s, pol); } case 8: { - T c = boost::math::cos_pi(x); - T c3 = boost::math::cos_pi(3 * x); - T c5 = boost::math::cos_pi(5 * x); - T c7 = boost::math::cos_pi(7 * x); - return 2 * boost::math::pow<8>(constants::pi()) * (15619 * c + 4293 * c3 + 247 * c5 + c7) / boost::math::pow<9>(s); + T c = boost::math::cos_pi(x, pol); + T c3 = boost::math::cos_pi(3 * x, pol); + T c5 = boost::math::cos_pi(5 * x, pol); + T c7 = boost::math::cos_pi(7 * x, pol); + return 2 * boost::math::pow<8>(constants::pi(), pol) * (15619 * c + 4293 * c3 + 247 * c5 + c7) / boost::math::pow<9>(s, pol); } case 9: { - T c2 = boost::math::cos_pi(2 * x); - T c4 = boost::math::cos_pi(4 * x); - T c6 = boost::math::cos_pi(6 * x); - T c8 = boost::math::cos_pi(8 * x); - return -2 * boost::math::pow<9>(constants::pi()) * (88234 * c2 + 14608 * c4 + 502 * c6 + c8 + 78095) / boost::math::pow<10>(s); + T c2 = boost::math::cos_pi(2 * x, pol); + T c4 = boost::math::cos_pi(4 * x, pol); + T c6 = boost::math::cos_pi(6 * x, pol); + T c8 = boost::math::cos_pi(8 * x, pol); + return -2 * boost::math::pow<9>(constants::pi(), pol) * (88234 * c2 + 14608 * c4 + 502 * c6 + c8 + 78095) / boost::math::pow<10>(s, pol); } case 10: { - T c = boost::math::cos_pi(x); - T c3 = boost::math::cos_pi(3 * x); - T c5 = boost::math::cos_pi(5 * x); - T c7 = boost::math::cos_pi(7 * x); - T c9 = boost::math::cos_pi(9 * x); - return 2 * boost::math::pow<10>(constants::pi()) * (1310354 * c + 455192 * c3 + 47840 * c5 + 1013 * c7 + c9) / boost::math::pow<11>(s); + T c = boost::math::cos_pi(x, pol); + T c3 = boost::math::cos_pi(3 * x, pol); + T c5 = boost::math::cos_pi(5 * x, pol); + T c7 = boost::math::cos_pi(7 * x, pol); + T c9 = boost::math::cos_pi(9 * x, pol); + return 2 * boost::math::pow<10>(constants::pi(), pol) * (1310354 * c + 455192 * c3 + 47840 * c5 + 1013 * c7 + c9) / boost::math::pow<11>(s, pol); } case 11: { - T c2 = boost::math::cos_pi(2 * x); - T c4 = boost::math::cos_pi(4 * x); - T c6 = boost::math::cos_pi(6 * x); - T c8 = boost::math::cos_pi(8 * x); - T c10 = boost::math::cos_pi(10 * x); - return -2 * boost::math::pow<11>(constants::pi()) * (7862124 + 9738114 * c2 + 2203488 * c4 + 152637 * c6 + 2036 * c8 + c10) / boost::math::pow<12>(s); + T c2 = boost::math::cos_pi(2 * x, pol); + T c4 = boost::math::cos_pi(4 * x, pol); + T c6 = boost::math::cos_pi(6 * x, pol); + T c8 = boost::math::cos_pi(8 * x, pol); + T c10 = boost::math::cos_pi(10 * x, pol); + return -2 * boost::math::pow<11>(constants::pi(), pol) * (7862124 + 9738114 * c2 + 2203488 * c4 + 152637 * c6 + 2036 * c8 + c10) / boost::math::pow<12>(s, pol); } case 12: { - T c = boost::math::cos_pi(x); - T c3 = boost::math::cos_pi(3 * x); - T c5 = boost::math::cos_pi(5 * x); - T c7 = boost::math::cos_pi(7 * x); - T c9 = boost::math::cos_pi(9 * x); - T c11 = boost::math::cos_pi(11 * x); - return 2 * boost::math::pow<12>(constants::pi()) * (162512286 * c + 66318474 * c3 + 10187685 * c5 + 478271 * c7 + 4083 * c9 + c11) / boost::math::pow<13>(s); + T c = boost::math::cos_pi(x, pol); + T c3 = boost::math::cos_pi(3 * x, pol); + T c5 = boost::math::cos_pi(5 * x, pol); + T c7 = boost::math::cos_pi(7 * x, pol); + T c9 = boost::math::cos_pi(9 * x, pol); + T c11 = boost::math::cos_pi(11 * x, pol); + return 2 * boost::math::pow<12>(constants::pi(), pol) * (162512286 * c + 66318474 * c3 + 10187685 * c5 + 478271 * c7 + 4083 * c9 + c11) / boost::math::pow<13>(s, pol); } case 13: { - T c2 = boost::math::cos_pi(2 * x); - T c4 = boost::math::cos_pi(4 * x); - T c6 = boost::math::cos_pi(6 * x); - T c8 = boost::math::cos_pi(8 * x); - T c10 = boost::math::cos_pi(10 * x); - T c12 = boost::math::cos_pi(12 * x); - return -2 * boost::math::pow<13>(constants::pi()) * (1137586002 + 1505621508 * c2 + 423281535 * c4 + 45533450 * c6 + 1479726 * c8 + 8178 * c10 + c12) / boost::math::pow<14>(s); + T c2 = boost::math::cos_pi(2 * x, pol); + T c4 = boost::math::cos_pi(4 * x, pol); + T c6 = boost::math::cos_pi(6 * x, pol); + T c8 = boost::math::cos_pi(8 * x, pol); + T c10 = boost::math::cos_pi(10 * x, pol); + T c12 = boost::math::cos_pi(12 * x, pol); + return -2 * boost::math::pow<13>(constants::pi(), pol) * (1137586002 + 1505621508 * c2 + 423281535 * c4 + 45533450 * c6 + 1479726 * c8 + 8178 * c10 + c12) / boost::math::pow<14>(s, pol); } +#ifndef BOOST_NO_LONG_LONG case 14: { - T c = boost::math::cos_pi(x); - T c3 = boost::math::cos_pi(3 * x); - T c5 = boost::math::cos_pi(5 * x); - T c7 = boost::math::cos_pi(7 * x); - T c9 = boost::math::cos_pi(9 * x); - T c11 = boost::math::cos_pi(11 * x); - T c13 = boost::math::cos_pi(13 * x); - return 2 * boost::math::pow<14>(constants::pi()) * (27971176092 * c + 12843262863 * c3 + 2571742175 * c5 + 198410786 * c7 + 4537314 * c9 + 16369 * c11 + c13) / boost::math::pow<15>(s); + T c = boost::math::cos_pi(x, pol); + T c3 = boost::math::cos_pi(3 * x, pol); + T c5 = boost::math::cos_pi(5 * x, pol); + T c7 = boost::math::cos_pi(7 * x, pol); + T c9 = boost::math::cos_pi(9 * x, pol); + T c11 = boost::math::cos_pi(11 * x, pol); + T c13 = boost::math::cos_pi(13 * x, pol); + return 2 * boost::math::pow<14>(constants::pi(), pol) * (27971176092uLL * c + 12843262863uLL * c3 + 2571742175uLL * c5 + 198410786 * c7 + 4537314 * c9 + 16369 * c11 + c13) / boost::math::pow<15>(s, pol); } case 15: { - return -2 * boost::math::pow<15>(constants::pi()) * - (223769408736 + 311387598411 * boost::math::cos_pi(2 * x) - + 102776998928 * boost::math::cos_pi(4 * x) - + 15041229521 * boost::math::cos_pi(6 * x) - + 848090912 * boost::math::cos_pi(8 * x) - + 13824739 * boost::math::cos_pi(10 * x) - + 32752 * boost::math::cos_pi(12 * x) - + boost::math::cos_pi(14 * x)) / boost::math::pow<16>(s); + return -2 * boost::math::pow<15>(constants::pi(), pol) * + (223769408736uLL + 311387598411uLL * boost::math::cos_pi(2 * x, pol) + + 102776998928uLL * boost::math::cos_pi(4 * x, pol) + + 15041229521uLL * boost::math::cos_pi(6 * x, pol) + + 848090912 * boost::math::cos_pi(8 * x, pol) + + 13824739 * boost::math::cos_pi(10 * x, pol) + + 32752 * boost::math::cos_pi(12 * x, pol) + + boost::math::cos_pi(14 * x, pol)) / boost::math::pow<16>(s, pol); } case 16: { - return 2 * boost::math::pow<16>(constants::pi()) * - (6382798925475 * boost::math::cos_pi(x) - + 3207483178157 * boost::math::cos_pi(3 * x) - + 782115518299 * boost::math::cos_pi(5 * x) - + 85383238549 * boost::math::cos_pi(7 * x) - + 3572085255 * boost::math::cos_pi(9 * x) - + 41932745 * boost::math::cos_pi(11 * x) - + 65519 * boost::math::cos_pi(13 * x) - + boost::math::cos_pi(15 * x)) / boost::math::pow<17>(s); + return 2 * boost::math::pow<16>(constants::pi(), pol) * + (6382798925475uLL * boost::math::cos_pi(x, pol) + + 3207483178157uLL * boost::math::cos_pi(3 * x, pol) + + 782115518299uLL * boost::math::cos_pi(5 * x, pol) + + 85383238549uLL * boost::math::cos_pi(7 * x, pol) + + 3572085255uLL * boost::math::cos_pi(9 * x, pol) + + 41932745 * boost::math::cos_pi(11 * x, pol) + + 65519 * boost::math::cos_pi(13 * x, pol) + + boost::math::cos_pi(15 * x, pol)) / boost::math::pow<17>(s, pol); } case 17: { - return -2 * boost::math::pow<17>(constants::pi()) * - (57445190329275 + 83137223185370 * boost::math::cos_pi(2 * x) - + 31055652948388 * boost::math::cos_pi(4 * x) - + 5717291972382 * boost::math::cos_pi(6 * x) - + 473353301060 * boost::math::cos_pi(8 * x) - + 14875399450 * boost::math::cos_pi(10 * x) - + 126781020 * boost::math::cos_pi(12 * x) - + 131054 * boost::math::cos_pi(14 * x) - + boost::math::cos_pi(16 * x)) / boost::math::pow<18>(s); + return -2 * boost::math::pow<17>(constants::pi(), pol) * + (57445190329275uLL + 83137223185370uLL * boost::math::cos_pi(2 * x, pol) + + 31055652948388uLL * boost::math::cos_pi(4 * x, pol) + + 5717291972382uLL * boost::math::cos_pi(6 * x, pol) + + 473353301060uLL * boost::math::cos_pi(8 * x, pol) + + 14875399450uLL * boost::math::cos_pi(10 * x, pol) + + 126781020 * boost::math::cos_pi(12 * x, pol) + + 131054 * boost::math::cos_pi(14 * x, pol) + + boost::math::cos_pi(16 * x, pol)) / boost::math::pow<18>(s, pol); } case 18: { - return 2 * boost::math::pow<18>(constants::pi()) * - (1865385657780650 * boost::math::cos_pi(x) - + 1006709967915228 * boost::math::cos_pi(3 * x) - + 285997074307300 * boost::math::cos_pi(5 * x) - + 40457344748072 * boost::math::cos_pi(7 * x) - + 2575022097600 * boost::math::cos_pi(9 * x) - + 61403313100 * boost::math::cos_pi(11 * x) - + 382439924 * boost::math::cos_pi(13 * x) - + 262125 * boost::math::cos_pi(15 * x) - + boost::math::cos_pi(17 * x)) / boost::math::pow<19>(s); + return 2 * boost::math::pow<18>(constants::pi(), pol) * + (1865385657780650uLL * boost::math::cos_pi(x, pol) + + 1006709967915228uLL * boost::math::cos_pi(3 * x, pol) + + 285997074307300uLL * boost::math::cos_pi(5 * x, pol) + + 40457344748072uLL * boost::math::cos_pi(7 * x, pol) + + 2575022097600uLL * boost::math::cos_pi(9 * x, pol) + + 61403313100uLL * boost::math::cos_pi(11 * x, pol) + + 382439924 * boost::math::cos_pi(13 * x, pol) + + 262125 * boost::math::cos_pi(15 * x, pol) + + boost::math::cos_pi(17 * x, pol)) / boost::math::pow<19>(s, pol); } case 19: { - return -2 * boost::math::pow<19>(constants::pi()) * - (18653856577806500 + 27862280567093358 * boost::math::cos_pi(2 * x) - + 11485644635009424 * boost::math::cos_pi(4 * x) - + 2527925001876036 * boost::math::cos_pi(6 * x) - + 278794377854832 * boost::math::cos_pi(8 * x) - + 13796160184500 * boost::math::cos_pi(10 * x) - + 251732291184 * boost::math::cos_pi(12 * x) - + 1151775897 * boost::math::cos_pi(14 * x) - + 524268 * boost::math::cos_pi(16 * x) - + boost::math::cos_pi(18 * x)) / boost::math::pow<20>(s); + return -2 * boost::math::pow<19>(constants::pi(), pol) * + (18653856577806500uLL + 27862280567093358uLL * boost::math::cos_pi(2 * x, pol) + + 11485644635009424uLL * boost::math::cos_pi(4 * x, pol) + + 2527925001876036uLL * boost::math::cos_pi(6 * x, pol) + + 278794377854832uLL * boost::math::cos_pi(8 * x, pol) + + 13796160184500uLL * boost::math::cos_pi(10 * x, pol) + + 251732291184uLL * boost::math::cos_pi(12 * x, pol) + + 1151775897uLL * boost::math::cos_pi(14 * x, pol) + + 524268 * boost::math::cos_pi(16 * x, pol) + + boost::math::cos_pi(18 * x, pol)) / boost::math::pow<20>(s, pol); } case 20: { - return 2 * boost::math::pow<20>(constants::pi()) * - (679562217794156938 * boost::math::cos_pi(x) - + 388588260723953310 * boost::math::cos_pi(3 * x) - + 124748182104463860 * boost::math::cos_pi(5 * x) - + 21598596303099900 * boost::math::cos_pi(7 * x) - + 1879708669896492 * boost::math::cos_pi(9 * x) - + 73008517581444 * boost::math::cos_pi(11 * x) - + 1026509354985 * boost::math::cos_pi(13 * x) - + 3464764515 * boost::math::cos_pi(15 * x) - + 1048555 * boost::math::cos_pi(17 * x) - + boost::math::cos_pi(19 * x)) / boost::math::pow<21>(s); + return 2 * boost::math::pow<20>(constants::pi(), pol) * + (679562217794156938uLL * boost::math::cos_pi(x, pol) + + 388588260723953310uLL * boost::math::cos_pi(3 * x, pol) + + 124748182104463860uLL * boost::math::cos_pi(5 * x, pol) + + 21598596303099900uLL * boost::math::cos_pi(7 * x, pol) + + 1879708669896492uLL * boost::math::cos_pi(9 * x, pol) + + 73008517581444uLL * boost::math::cos_pi(11 * x, pol) + + 1026509354985uLL * boost::math::cos_pi(13 * x, pol) + + 3464764515uLL * boost::math::cos_pi(15 * x, pol) + + 1048555 * boost::math::cos_pi(17 * x, pol) + + boost::math::cos_pi(19 * x, pol)) / boost::math::pow<21>(s, pol); } case 21: { - return -2 * boost::math::pow<21>(constants::pi()) * - (7475184395735726318 + 11458681306629009100 * boost::math::cos_pi(2 * x) - + 5119020713873609970 * boost::math::cos_pi(4 * x) - + 1300365805079109480 * boost::math::cos_pi(6 * x) - + 179385804170146680 * boost::math::cos_pi(8 * x) - + 12446388300682056 * boost::math::cos_pi(10 * x) - + 382493246941965 * boost::math::cos_pi(12 * x) - + 4168403181210 * boost::math::cos_pi(14 * x) - + 10414216090 * boost::math::cos_pi(16 * x) - + 2097130 * boost::math::cos_pi(18 * x) - + boost::math::cos_pi(20 * x)) / boost::math::pow<22>(s); + return -2 * boost::math::pow<21>(constants::pi(), pol) * + (7475184395735726318uLL + 11458681306629009100uLL * boost::math::cos_pi(2 * x, pol) + + 5119020713873609970uLL * boost::math::cos_pi(4 * x, pol) + + 1300365805079109480uLL * boost::math::cos_pi(6 * x, pol) + + 179385804170146680uLL * boost::math::cos_pi(8 * x, pol) + + 12446388300682056uLL * boost::math::cos_pi(10 * x, pol) + + 382493246941965uLL * boost::math::cos_pi(12 * x, pol) + + 4168403181210uLL * boost::math::cos_pi(14 * x, pol) + + 10414216090uLL * boost::math::cos_pi(16 * x, pol) + + 2097130 * boost::math::cos_pi(18 * x, pol) + + boost::math::cos_pi(20 * x, pol)) / boost::math::pow<22>(s, pol); } +#endif } // @@ -515,7 +519,7 @@ // for(unsigned j = 0; j < table[index].size(); ++j) { - sum += table[index][j] * boost::math::cos_pi(x * power); + sum += table[index][j] * boost::math::cos_pi(x * power, pol); power += 2; } if(sum == 0) diff --git a/test/float128/test_polygamma.cpp b/test/float128/test_polygamma.cpp index 37d2f778b..4debc41a9 100644 --- a/test/float128/test_polygamma.cpp +++ b/test/float128/test_polygamma.cpp @@ -15,13 +15,20 @@ void expected_results() // Define the max and mean errors expected for // various compilers and platforms. // + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*bug cases.*", // test data group + ".*", 100000, 40000); // test function add_expected_result( ".*", // compiler ".*", // stdlib ".*", // platform ".*", // test type(s) ".*", // test data group - ".*", 350, 100); // test function + ".*", 350, 100); // test function // // Finish off by printing out the compiler/stdlib/platform names, // we do this to make it easier to mark up expected error rates. diff --git a/test/test_polygamma.cpp b/test/test_polygamma.cpp index e6037367e..7c0ec3b78 100644 --- a/test/test_polygamma.cpp +++ b/test/test_polygamma.cpp @@ -40,7 +40,18 @@ void expected_results() ".*", // platform largest_type, // test type(s) ".*negative.*", // test data group - ".*", 1400, 500); // test function + ".*", 4000, 1000); // test function + if((std::numeric_limits::digits > std::numeric_limits::digits) + && (std::numeric_limits::digits - std::numeric_limits::digits < 20)) + { + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "double", // test type(s) + ".*bug cases.*", // test data group + ".*", 100, 30); // test function + } add_expected_result( ".*", // compiler ".*", // stdlib diff --git a/test/test_polygamma.hpp b/test/test_polygamma.hpp index 491271fdc..bb053ea20 100644 --- a/test/test_polygamma.hpp +++ b/test/test_polygamma.hpp @@ -137,7 +137,7 @@ void test_polygamma(T, const char* name) } }; do_test_polygamma(big_data, name, "Mathematica Data - large arguments"); - boost::array, 399> neg_data = + boost::array, 471> neg_data = { { { 1, SC_(-12.750), SC_(19.663772856722737612034697464751605) }, { 1, SC_(-12.250), SC_(19.660817549236368273654684043826967) }, { 1, SC_(-11.750), SC_(19.657621376522814505537196503582823) }, { 1, SC_(-11.250), SC_(19.654153659190554029589711115880278) }, { 1, SC_(-10.750), SC_(19.650378280099093364749509767503149) }, { 1, SC_(-10.250), SC_(19.646252424622652795021809881312377) }, { 1, SC_(-9.7500), SC_(19.641724953976865133273035997897957) }, { 1, SC_(-9.2500), SC_(19.636734280660725370869519577921538) }, { 1, SC_(-8.7500), SC_(19.631205558842085383108670448917024) }, { 1, SC_(-8.2500), SC_(19.625046917622010980803778160828770) }, { 1, SC_(-7.7500), SC_(19.618144334352289464741323510141514) }, { 1, SC_(-7.2500), SC_(19.610354539293269015698176691590937) }, { 1, SC_(-6.7500), SC_(19.601495010731061577124257953429755) }, { 1, SC_(-6.2500), SC_(19.591329569019785068016844943671793) }, { 1, SC_(-5.7500), SC_(19.579547136931335925546754524074474) }, { 1, SC_(-5.2500), SC_(19.565729569019785068016844943671793) }, { 1, SC_(-4.7500), SC_(19.549301390239464469970194977760674) }, { 1, SC_(-4.2500), SC_(19.529448389881463072551992335962043) }, { 1, SC_(-3.7500), SC_(19.504980060599575273294294700752364) }, { 1, SC_(-3.2500), SC_(19.474085068082155114074483685443011) }, { 1, SC_(-2.7500), SC_(19.433868949488464162183183589641253) }, { 1, SC_(-2.2500), SC_(19.379410511869137362595193744614609) }, { 1, SC_(-1.7500), SC_(19.301637544529786476232770366500757) }, { 1, SC_(-1.2500), SC_(19.181879647671606498397662880417078) }, { 1, SC_(-0.75000), SC_(18.975106932284888517049096897113002) }, { 1, SC_(-0.25000), SC_(18.541879647671606498397662880417078) }, { 2, SC_(-12.750), SC_(-124.03079461415823384604153251543681) }, { 2, SC_(-12.250), SC_(124.01896466745858356132308878716344) }, { 2, SC_(-11.750), SC_(-124.03175955222881001960976796032603) }, { 2, SC_(-11.250), SC_(124.01787668541028735821044014586602) }, { 2, SC_(-10.750), SC_(-124.03299241970518808612682102178640) }, { 2, SC_(-10.250), SC_(124.01647202148710491650947992638728) }, { 2, SC_(-9.7500), SC_(-124.03460234084420729198290916496876) }, { 2, SC_(-9.2500), SC_(124.01461482266526541911391108670126) }, { 2, SC_(-8.7500), SC_(-124.03676016548723903560636876475972) }, { 2, SC_(-8.2500), SC_(124.01208782525148933477537240192445) }, { 2, SC_(-7.7500), SC_(-124.03974558822776381694747663647984) }, { 2, SC_(-7.2500), SC_(124.00852603656573370687098416695770) }, { 2, SC_(-6.7500), SC_(-124.04404218787195165891317097369578) }, { 2, SC_(-6.2500), SC_(124.00327776890408296268303058132483) }, { 2, SC_(-5.7500), SC_(-124.05054526159038888901020902683808) }, { 2, SC_(-5.2500), SC_(123.99508576890408296268303058132483) }, { 2, SC_(-4.7500), SC_(-124.06106552130930069964553408642549) }, { 2, SC_(-4.2500), SC_(123.98126436732757934536308673076874) }, { 2, SC_(-3.7500), SC_(-124.07972713378925404561433420306057) }, { 2, SC_(-3.2500), SC_(123.95521103942202265902072971875978) }, { 2, SC_(-2.7500), SC_(-124.11765305971517997154026012898649) }, { 2, SC_(-2.2500), SC_(123.89694977406016558118732052440384) }, { 2, SC_(-1.7500), SC_(-124.21382135423058192495874247308867) }, { 2, SC_(-1.2500), SC_(123.72136678366236036856729308956159) }, { 2, SC_(-0.75000), SC_(-124.58699919679617959259722643810325) }, { 2, SC_(-0.25000), SC_(122.69736678366236036856729308956159) }, @@ -158,8 +158,8 @@ void test_polygamma(T, const char* name) { SC_(3.0), SC_(-4.75), SC_(1558.5318783056006283387768251220856) }, { SC_(4.0), SC_(-4.75), SC_(-24481.582451925002662084791450344735) }, { SC_(5.0), SC_(-4.75), SC_(492231.26135104955223808370232711841) }, { SC_(6.0), SC_(-4.75), SC_(-1.1791224766632825018904254258839318e7) }, { SC_(7.0), SC_(-4.75), SC_(3.3035269584947086190323815702711063e8) }, { SC_(8.0), SC_(-4.75), SC_(-1.0569114259674567879524502974422220e10) }, { SC_(9.0), SC_(-4.75), SC_(3.8051374324232805216534792821594812e11) }, { SC_(10.0), SC_(-4.75), SC_(-1.5220204740668360644738342521168221e13) }, { SC_(11.0), SC_(-4.75), SC_(6.6969403856797200883878751610651220e14) }, { SC_(12.0), SC_(-4.75), SC_(-3.2145233093874118410246620594666049e16) }, { SC_(13.0), SC_(-4.75), SC_(1.6715535177261375554006502097069245e18) }, { SC_(14.0), SC_(-4.75), SC_(-9.3606970885707978200117071697879591e19) }, { SC_(15.0), SC_(-4.75), SC_(5.6164187748870728746282195405281448e21) }, { SC_(16.0), SC_(-4.75), SC_(-3.5945079045721164734032997263075953e23) }, { SC_(17.0), SC_(-4.75), SC_(2.4442654003427929640663758934254941e25) }, { SC_(18.0), SC_(-4.75), SC_(-1.7598710821897274459494051446575390e27) }, { SC_(19.0), SC_(-4.75), SC_(1.3375020239985042298043467743154361e29) }, { SC_(20.0), SC_(-4.75), SC_(-1.0700016187896297695358366297508349e31) }, { SC_(21.0), SC_(-4.75), SC_(8.9880135989785359476536358804280906e32) }, { SC_(22.0), SC_(-4.75), SC_(-7.9094519667650484338896180683559907e34) }, { SC_(23.0), SC_(-4.75), SC_(7.2766958095269026379022334905108714e36) }, { SC_(1.0), SC_(-9.5), SC_(9.7696874450302318856305468284306792)}, { SC_(3.0), SC_(-9.5), SC_(194.81619198176773011863271713047162) }, { SC_(5.0), SC_(-9.5), SC_(15382.226860156995915624995579131219) }, { SC_(7.0), SC_(-9.5), SC_(2.5808804363008334969805587475917565e6) }, { SC_(9.0), SC_(-9.5), SC_(7.4319090477015599086877150154313919e8) }, { SC_(11.0), SC_(-9.5), SC_(3.2699904226951756570017589463296126e11) }, { SC_(13.0), SC_(-9.5), SC_(2.0404706026930390078103975418992502e14) }, { SC_(15.0), SC_(-9.5), SC_(1.7139949874533303450398622617829339e17) }, { SC_(17.0), SC_(-9.5), SC_(1.8648265078298896515398973583300966e20) }, { SC_(19.0), SC_(-9.5), SC_(2.5510826568574986072623191304028880e23) }, { SC_(21.0), SC_(-9.5), SC_(4.2858188624279670465725116159418790e26) }, { SC_(2.0), SC_(-9.5), SC_(-0.0099751442477151692853059194570941025) }, { SC_(4.0), SC_(-9.5), SC_(-0.00059506011900940675655749713967447346) }, { SC_(6.0), SC_(-9.5), SC_(-0.00011794286977626608581527674104044053) }, { SC_(8.0), SC_(-9.5), SC_(-0.000048934615584055214532361558113243801) }, { SC_(10.0), SC_(-9.5), SC_(-0.000034696555222805555969152083201249795) }, { SC_(12.0), SC_(-9.5), SC_(-0.000037470635416758472254487967117333555) }, { SC_(14.0), SC_(-9.5), SC_(-0.000057218576281198884425118075685027774) }, { SC_(16.0), SC_(-9.5), SC_(-0.00011728023376485851827598955099805232) }, { SC_(18.0), SC_(-9.5), SC_(-0.00031049110045758006635527458576736345) }, { SC_(20.0), SC_(-9.5), SC_(-0.0010307637762451416598018081796345932) }, - { SC_(2.0), SC_(-9.5367431640625e-7), SC_(2.3058430092136939495958800005662742e18) }, { SC_(2.0), SC_(-5.960464477539063e-8), SC_(9.4447329657392904273895958858066118e21) }, { SC_(2.0), SC_(-3.725290298461914e-9), SC_(3.8685626227668133590597629595886169e25) }, { SC_(2.0), SC_(-2.3283064365386963e-10), SC_(1.5845632502852867518708790066959589e29) }, { SC_(2.0), SC_(-1.4551915228366852e-11), SC_(6.4903710731685345356631204115250960e32) }, { SC_(2.0), SC_(-9.094947017729282e-13), SC_(2.6584559915698317458076141205606891e36) }, { SC_(2.0), SC_(-5.684341886080802e-14), SC_(1.0889035741470030830827987437816583e40) }, { SC_(2.0), SC_(-3.552713678800501e-15), SC_(4.4601490397061246283071436545296723e43) }, { SC_(2.0), SC_(-2.220446049250313e-16), SC_(1.8268770466636286477546060408953538e47) }, { SC_(2.0), SC_(-1.3877787807814457e-17), SC_(7.4828883831342229412028663435073691e50) }, { SC_(2.0), SC_(-8.673617379884035e-19), SC_(3.0649910817317777167166940543006184e54) }, { SC_(2.0), SC_(-5.421010862427522e-20), SC_(1.2554203470773361527671578846415333e58) }, { SC_(2.0), SC_(-3.3881317890172014e-21), SC_(5.1422017416287688817342786954917203e61) }, - { SC_(3.0), SC_(-9.5367431640625e-7), SC_(7.2535549176877750482370624939631357e24) }, { SC_(3.0), SC_(-5.960464477539063e-8), SC_(4.7536897508558602556126370202249394e29) }, { SC_(3.0), SC_(-3.725290298461914e-9), SC_(3.1153781151208965771182977975320582e34) }, { SC_(3.0), SC_(-2.3283064365386963e-10), SC_(2.0416942015256307807802476445906093e39) }, { SC_(3.0), SC_(-1.4551915228366852e-11), SC_(1.3380447119118373884921430963589017e44) }, { SC_(3.0), SC_(-9.094947017729282e-13), SC_(8.7690098239854175092221089962976981e48) }, { SC_(3.0), SC_(-5.684341886080802e-14), SC_(5.7468582782470832188438013518136594e53) }, { SC_(3.0), SC_(-3.552713678800501e-15), SC_(3.7662610412320084583014736539245998e58) }, { SC_(3.0), SC_(-2.220446049250313e-16), SC_(2.4682568359818090632324537738360258e63) }, { SC_(3.0), SC_(-1.3877787807814457e-17), SC_(1.6175968000290383876800209052211778e68) }, { SC_(3.0), SC_(-8.673617379884035e-19), SC_(1.0601082388670305977499785004457511e73) }, { SC_(3.0), SC_(-5.421010862427522e-20), SC_(6.9475253542389717254142591005212745e77) }, { SC_(3.0), SC_(-3.3881317890172014e-21), SC_(4.5531302161540525099674888441176224e82) }, + { SC_(2.0), SC_(-9.5367431640625000000000000000000000e-7), SC_(2.3058430092136939495958800005662742e18) }, { SC_(2.0), SC_(-4.7683715820312500000000000000000000e-7), SC_(1.8446744073709551613595883097126372e19) }, { SC_(2.0), SC_(-2.3841857910156250000000000000000000e-7), SC_(1.4757395258967641292559588464540430e20) }, { SC_(2.0), SC_(-1.1920928955078125000000000000000000e-7), SC_(1.1805916207174113034215958854195427e21) }, { SC_(2.0), SC_(-5.9604644775390625000000000000000000e-8), SC_(9.4447329657392904273895958858066118e21) }, { SC_(2.0), SC_(-2.9802322387695312500000000000000000e-8), SC_(7.5557863725914323419133595886000146e22) }, { SC_(2.0), SC_(-1.4901161193847656250000000000000000e-8), SC_(6.0446290980731458735308559588609691e23) }, { SC_(2.0), SC_(-7.4505805969238281250000000000000000e-9), SC_(4.8357032784585166988247015958861453e24) }, { SC_(2.0), SC_(-3.7252902984619140625000000000000000e-9), SC_(3.8685626227668133590597629595886169e25) }, { SC_(2.0), SC_(-1.8626451492309570312500000000000000e-9), SC_(3.0948500982134506872478105359588618e26) }, { SC_(2.0), SC_(-9.3132257461547851562500000000000000e-10), SC_(2.4758800785707605497982484455958862e27) }, { SC_(2.0), SC_(-4.6566128730773925781250000000000000e-10), SC_(1.9807040628566084398385987581595886e28) }, { SC_(2.0), SC_(-2.3283064365386962890625000000000000e-10), SC_(1.5845632502852867518708790066959589e29) }, { SC_(2.0), SC_(-1.1641532182693481445312500000000000e-10), SC_(1.2676506002282294014967032053735959e30) }, { SC_(2.0), SC_(-5.8207660913467407226562500000000000e-11), SC_(1.0141204801825835211973625643005596e31) }, { SC_(2.0), SC_(-2.9103830456733703613281250000000000e-11), SC_(8.1129638414606681695789005144061596e31) }, { SC_(2.0), SC_(-1.4551915228366851806640625000000000e-11), SC_(6.4903710731685345356631204115250960e32) }, { SC_(2.0), SC_(-7.2759576141834259033203125000000000e-12), SC_(5.1922968585348276285304963292200936e33) }, { SC_(2.0), SC_(-3.6379788070917129516601562500000000e-12), SC_(4.1538374868278621028243970633760766e34) }, { SC_(2.0), SC_(-1.8189894035458564758300781250000000e-12), SC_(3.3230699894622896822595176507008614e35) }, { SC_(2.0), SC_(-9.0949470177292823791503906250000000e-13), SC_(2.6584559915698317458076141205606891e36) }, { SC_(2.0), SC_(-4.5474735088646411895751953125000000e-13), SC_(2.1267647932558653966460912964485513e37) }, { SC_(2.0), SC_(-2.2737367544323205947875976562500000e-13), SC_(1.7014118346046923173168730371588411e38) }, { SC_(2.0), SC_(-1.1368683772161602973937988281250000e-13), SC_(1.3611294676837538538534984297270728e39) }, { SC_(2.0), SC_(-5.6843418860808014869689941406250000e-14), SC_(1.0889035741470030830827987437816583e40) }, { SC_(2.0), SC_(-2.8421709430404007434844970703125000e-14), SC_(8.7112285931760246646623899502532662e40) }, { SC_(2.0), SC_(-1.4210854715202003717422485351562500e-14), SC_(6.9689828745408197317299119602026130e41) }, { SC_(2.0), SC_(-7.1054273576010018587112426757812500e-15), SC_(5.5751862996326557853839295681620904e42) }, { SC_(2.0), SC_(-3.5527136788005009293556213378906250e-15), SC_(4.4601490397061246283071436545296723e43) }, { SC_(2.0), SC_(-1.7763568394002504646778106689453125e-15), SC_(3.5681192317648997026457149236237378e44) }, { SC_(2.0), SC_(-8.8817841970012523233890533447265625e-16), SC_(2.8544953854119197621165719388989903e45) }, { SC_(2.0), SC_(-4.4408920985006261616945266723632812e-16), SC_(2.2835963083295358096932575511191922e46) }, { SC_(2.0), SC_(-2.2204460492503130808472633361816406e-16), SC_(1.8268770466636286477546060408953538e47) }, { SC_(2.0), SC_(-1.1102230246251565404236316680908203e-16), SC_(1.4615016373309029182036848327162830e48) }, { SC_(2.0), SC_(-5.5511151231257827021181583404541016e-17), SC_(1.1692013098647223345629478661730264e49) }, { SC_(2.0), SC_(-2.7755575615628913510590791702270508e-17), SC_(9.3536104789177786765035829293842113e49) }, { SC_(2.0), SC_(-1.3877787807814456755295395851135254e-17), SC_(7.4828883831342229412028663435073691e50) }, { SC_(2.0), SC_(-6.9388939039072283776476979255676270e-18), SC_(5.9863107065073783529622930748058952e51) }, { SC_(2.0), SC_(-3.4694469519536141888238489627838135e-18), SC_(4.7890485652059026823698344598447162e52) }, { SC_(2.0), SC_(-1.7347234759768070944119244813919067e-18), SC_(3.8312388521647221458958675678757730e53) }, { SC_(2.0), SC_(-8.6736173798840354720596224069595337e-19), SC_(3.0649910817317777167166940543006184e54) }, { SC_(2.0), SC_(-4.3368086899420177360298112034797668e-19), SC_(2.4519928653854221733733552434404947e55) }, { SC_(2.0), SC_(-2.1684043449710088680149056017398834e-19), SC_(1.9615942923083377386986841947523958e56) }, { SC_(2.0), SC_(-1.0842021724855044340074528008699417e-19), SC_(1.5692754338466701909589473558019166e57) }, { SC_(2.0), SC_(-5.4210108624275221700372640043497086e-20), SC_(1.2554203470773361527671578846415333e58) }, { SC_(2.0), SC_(-2.7105054312137610850186320021748543e-20), SC_(1.0043362776618689222137263077132266e59) }, { SC_(2.0), SC_(-1.3552527156068805425093160010874271e-20), SC_(8.0346902212949513777098104617058130e59) }, { SC_(2.0), SC_(-6.7762635780344027125465800054371357e-21), SC_(6.4277521770359611021678483693646504e60) }, { SC_(2.0), SC_(-3.3881317890172013562732900027185678e-21), SC_(5.1422017416287688817342786954917203e61) }, + { SC_(3.0), SC_(-9.5367431640625000000000000000000000e-7), SC_(7.2535549176877750482370624939631357e24) }, { SC_(3.0), SC_(-4.7683715820312500000000000000000000e-7), SC_(1.1605687868300440077179290249395127e26) }, { SC_(3.0), SC_(-2.3841857910156250000000000000000000e-7), SC_(1.8569100589280704123486863424939453e27) }, { SC_(3.0), SC_(-1.1920928955078125000000000000000000e-7), SC_(2.9710560942849126597578981382493942e28) }, { SC_(3.0), SC_(-5.9604644775390625000000000000000000e-8), SC_(4.7536897508558602556126370202249394e29) }, { SC_(3.0), SC_(-2.9802322387695312500000000000000000e-8), SC_(7.6059036013693764089802192322624939e30) }, { SC_(3.0), SC_(-1.4901161193847656250000000000000000e-8), SC_(1.2169445762191002254368350771610249e32) }, { SC_(3.0), SC_(-7.4505805969238281250000000000000000e-9), SC_(1.9471113219505603606989361234575425e33) }, { SC_(3.0), SC_(-3.7252902984619140625000000000000000e-9), SC_(3.1153781151208965771182977975320582e34) }, { SC_(3.0), SC_(-1.8626451492309570312500000000000000e-9), SC_(4.9846049841934345233892764760512922e35) }, { SC_(3.0), SC_(-9.3132257461547851562500000000000000e-10), SC_(7.9753679747094952374228423616820675e36) }, { SC_(3.0), SC_(-4.6566128730773925781250000000000000e-10), SC_(1.2760588759535192379876547778691308e38) }, { SC_(3.0), SC_(-2.3283064365386962890625000000000000e-10), SC_(2.0416942015256307807802476445906093e39) }, { SC_(3.0), SC_(-1.1641532182693481445312500000000000e-10), SC_(3.2667107224410092492483962313449748e40) }, { SC_(3.0), SC_(-5.8207660913467407226562500000000000e-11), SC_(5.2267371559056147987974339701519597e41) }, { SC_(3.0), SC_(-2.9103830456733703613281250000000000e-11), SC_(8.3627794494489836780758943522431356e42) }, { SC_(3.0), SC_(-1.4551915228366851806640625000000000e-11), SC_(1.3380447119118373884921430963589017e44) }, { SC_(3.0), SC_(-7.2759576141834259033203125000000000e-12), SC_(2.1408715390589398215874289541742427e45) }, { SC_(3.0), SC_(-3.6379788070917129516601562500000000e-12), SC_(3.4253944624943037145398863266787883e46) }, { SC_(3.0), SC_(-1.8189894035458564758300781250000000e-12), SC_(5.4806311399908859432638181226860613e47) }, { SC_(3.0), SC_(-9.0949470177292823791503906250000000e-13), SC_(8.7690098239854175092221089962976981e48) }, { SC_(3.0), SC_(-4.5474735088646411895751953125000000e-13), SC_(1.4030415718376668014755374394076317e50) }, { SC_(3.0), SC_(-2.2737367544323205947875976562500000e-13), SC_(2.2448665149402668823608599030522107e51) }, { SC_(3.0), SC_(-1.1368683772161602973937988281250000e-13), SC_(3.5917864239044270117773758448835371e52) }, { SC_(3.0), SC_(-5.6843418860808014869689941406250000e-14), SC_(5.7468582782470832188438013518136594e53) }, { SC_(3.0), SC_(-2.8421709430404007434844970703125000e-14), SC_(9.1949732451953331501500821629018551e54) }, { SC_(3.0), SC_(-1.4210854715202003717422485351562500e-14), SC_(1.4711957192312533040240131460642968e56) }, { SC_(3.0), SC_(-7.1054273576010018587112426757812500e-15), SC_(2.3539131507700052864384210337028749e57) }, { SC_(3.0), SC_(-3.5527136788005009293556213378906250e-15), SC_(3.7662610412320084583014736539245998e58) }, { SC_(3.0), SC_(-1.7763568394002504646778106689453125e-15), SC_(6.0260176659712135332823578462793598e59) }, { SC_(3.0), SC_(-8.8817841970012523233890533447265625e-16), SC_(9.6416282655539416532517725540469756e60) }, { SC_(3.0), SC_(-4.4408920985006261616945266723632812e-16), SC_(1.5426605224886306645202836086475161e62) }, { SC_(3.0), SC_(-2.2204460492503130808472633361816406e-16), SC_(2.4682568359818090632324537738360258e63) }, { SC_(3.0), SC_(-1.1102230246251565404236316680908203e-16), SC_(3.9492109375708945011719260381376412e64) }, { SC_(3.0), SC_(-5.5511151231257827021181583404541016e-17), SC_(6.3187375001134312018750816610202259e65) }, { SC_(3.0), SC_(-2.7755575615628913510590791702270508e-17), SC_(1.0109980000181489923000130657632362e67) }, { SC_(3.0), SC_(-1.3877787807814456755295395851135254e-17), SC_(1.6175968000290383876800209052211778e68) }, { SC_(3.0), SC_(-6.9388939039072283776476979255676270e-18), SC_(2.5881548800464614202880334483538845e69) }, { SC_(3.0), SC_(-3.4694469519536141888238489627838135e-18), SC_(4.1410478080743382724608535173662153e70) }, { SC_(3.0), SC_(-1.7347234759768070944119244813919067e-18), SC_(6.6256764929189412359373656277859444e71) }, { SC_(3.0), SC_(-8.6736173798840354720596224069595337e-19), SC_(1.0601082388670305977499785004457511e73) }, { SC_(3.0), SC_(-4.3368086899420177360298112034797668e-19), SC_(1.6961731821872489563999656007132018e74) }, { SC_(3.0), SC_(-2.1684043449710088680149056017398834e-19), SC_(2.7138770914995983302399449611411228e75) }, { SC_(3.0), SC_(-1.0842021724855044340074528008699417e-19), SC_(4.3422033463993573283839119378257965e76) }, { SC_(3.0), SC_(-5.4210108624275221700372640043497086e-20), SC_(6.9475253542389717254142591005212745e77) }, { SC_(3.0), SC_(-2.7105054312137610850186320021748543e-20), SC_(1.1116040566782354760662814560834039e79) }, { SC_(3.0), SC_(-1.3552527156068805425093160010874271e-20), SC_(1.7785664906851767617060503297334463e80) }, { SC_(3.0), SC_(-6.7762635780344027125465800054371357e-21), SC_(2.8457063850962828187296805275735140e81) }, { SC_(3.0), SC_(-3.3881317890172013562732900027185678e-21), SC_(4.5531302161540525099674888441176224e82) }, } }; do_test_polygamma(neg_data, name, "Mathematica Data - negative arguments");