mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 16:32:10 +00:00
1F1: simplify log_pochhammer, add new test cases.
[CI SKIP]
This commit is contained in:
@@ -213,6 +213,7 @@
|
||||
inline T log_pochhammer(T z, unsigned n, const Policy pol, int* s = 0)
|
||||
{
|
||||
BOOST_MATH_STD_USING
|
||||
#if 0
|
||||
if (z < 0)
|
||||
{
|
||||
if (n < -z)
|
||||
@@ -228,10 +229,13 @@
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
int s1, s2;
|
||||
T r = lgamma(z + n, &s1, pol) - lgamma(z, &s2, pol);
|
||||
if(s)
|
||||
*s = 1;
|
||||
return lgamma(z + n) - lgamma(z);
|
||||
*s = s1 * s2;
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SC_
|
||||
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
|
||||
#endif
|
||||
static const boost::array<boost::array<T, 4>, 11> hypergeometric_1F1_big = {{
|
||||
static const boost::array<boost::array<T, 4>, 12> hypergeometric_1F1_big = {{
|
||||
{ SC_(-8.1472375000000000000000000000000000000000e+05), SC_(-1.3586878906250000000000000000000000000000e+04), SC_(-1.5873352050781250000000000000000000000000e+01), SC_(4.9489925464971372677922628162736666342744e-401) },
|
||||
{ SC_(-1.3547703125000000000000000000000000000000e+04), SC_(-1.2525131835937500000000000000000000000000e+03), SC_(-1.5873352050781250000000000000000000000000e+01), SC_(-2.5898494644592200447792014846620256493447e+43) },
|
||||
{ SC_(-9.0579218750000000000000000000000000000000e+03), SC_(-1.2525131835937500000000000000000000000000e+03), SC_(-1.5873352050781250000000000000000000000000e+01), SC_(8.3580772868001229331683618349570363666238e-49) },
|
||||
@@ -18,6 +18,11 @@
|
||||
{ { SC_(-5.9981750131794866e-15), SC_(0.499999999999994), SC_(-240.42092034220695), SC_(1.00000000000004464930530925572237133417488137) }},
|
||||
// Unexpected exception : Error in function boost::math::hypergeometric_pFq<long double> : Cancellation is so severe that no bits in the reuslt are correct, last result was 3.0871891698197084e+73
|
||||
{ { SC_(-5.9981750131794866e-15), SC_(-0.500000000000006), SC_(-240.42092034220695), SC_(1.00000000000003262784934420226963147689063665) }},
|
||||
|
||||
// This one is not too awful, we simply have no better method to improve the error rate:
|
||||
// Unexpected high error : 663646.042870225268416106700897216796875 Found : 3.2303512071340211020409327602465054951608181e-07 Expected : 3.23035120665799970299144868238205852151168074e-07
|
||||
{ { SC_(1.3785990114778025e-10), SC_(-0.99999999986214005), SC_(-3059.6150326728821), SC_(3.23035120665799974283996469721682549854387981e-07) }},
|
||||
|
||||
}};
|
||||
//#undef SC_
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ void test_spots5(T, const char* type_name)
|
||||
template <class T>
|
||||
void test_spots6(T, const char* type_name)
|
||||
{
|
||||
static const boost::array<boost::array<T, 4>, 53> hypergeometric_1F1_bugs = { {
|
||||
static const boost::array<boost::array<T, 4>, 55> hypergeometric_1F1_bugs = { {
|
||||
{ { SC_(17955.561660766602), SC_(9.6968994205831605e-09), SC_(-82.406154185533524), SC_(6.98056008378736714088730927132364938220428678e-11) }},
|
||||
{ { SC_(17955.561660766602), SC_(-9.6968994205831605e-09), SC_(-82.406154185533524), SC_(-6.98055306629610746072607353939306734740549551e-11) }},
|
||||
{ { SC_(-17955.561660766602), SC_(-9.6968994205831605e-09), SC_(82.406154185533524), SC_(-42897094853118832762870100.8669248353530950866) }} ,
|
||||
@@ -236,6 +236,12 @@ void test_spots6(T, const char* type_name)
|
||||
// Unexpected high error: 3.17219226436543247206316287281668161679098192e+185 Found: 1.00012411189051491970538746574092795078602734e+201 Expected: 14198882672502154063215954231296
|
||||
{{ SC_(76763.042617797852), SC_(-21.722407214343548), SC_(-0.60326536209322512), SC_(14198882672502153010712531896984.8126667697959) }},
|
||||
|
||||
// Unexpected high error: 1.79769313486231570814527423731704356798070568e+308 Found: -2.39521645877904927856730119998375850409649219e+124 Expected: 2.3952164587795095929135248712964248422934629e+124
|
||||
{{ SC_(-1.8857404964801872e-09), SC_(-226.52341184020042), SC_(160.86221924424171), SC_(2.39521645877950946848639784331327651190093595e+124) }},
|
||||
// Unexpected high error : 73027.246763920571538619697093963623046875 Found : 0.000111810625893715248580992382976262433658121154 Expected : 0.000111810625895528292111404111697225971511215903
|
||||
{ { SC_(-7.5220323642510769e-13), SC_(-1.0000000000007523), SC_(-17.948102783411741), SC_(0.00011181062589552829441403260197223627311023229) }},
|
||||
|
||||
|
||||
|
||||
} };
|
||||
static const boost::array<boost::array<T, 4>, 2> hypergeometric_1F1_big_bugs = { {
|
||||
|
||||
Reference in New Issue
Block a user