mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Merge pull request #687 from boostorg/s390x
Fix low hanging fruit test failures on s390x.
This commit is contained in:
@@ -64,6 +64,17 @@ T bessel_j0(T x)
|
||||
{
|
||||
bessel_j0_initializer<T>::force_instantiate();
|
||||
|
||||
#ifdef BOOST_MATH_INSTRUMENT
|
||||
static bool b = false;
|
||||
if (!b)
|
||||
{
|
||||
std::cout << "bessel_j0 called with " << typeid(x).name() << std::endl;
|
||||
std::cout << "double = " << typeid(double).name() << std::endl;
|
||||
std::cout << "long double = " << typeid(long double).name() << std::endl;
|
||||
b = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const T P1[] = {
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, -4.1298668500990866786e+11)),
|
||||
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.7282507878605942706e+10)),
|
||||
@@ -191,6 +202,11 @@ T bessel_j0(T x)
|
||||
//
|
||||
T sx = sin(x);
|
||||
T cx = cos(x);
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(rc);
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(rs);
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(factor);
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(sx);
|
||||
BOOST_MATH_INSTRUMENT_VARIABLE(cx);
|
||||
value = factor * (rc * (cx + sx) - y * rs * (sx - cx));
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,14 @@ void expected_results()
|
||||
"double", // test type(s)
|
||||
"Bug.*", // test data group
|
||||
".*", 300, 50); // test function
|
||||
#elif(LDBL_MANT_DIG != DBL_MANT_DIG)
|
||||
add_expected_result(
|
||||
".*", // compiler
|
||||
".*", // stdlib
|
||||
".*", // platform
|
||||
"double", // test type(s)
|
||||
".*double limited precision.*", // test data group
|
||||
".*", 10, 5); // test function
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -44,10 +44,12 @@ void test_airy(T, const char* name)
|
||||
{{ -2, static_cast<T>(0.227407428201685575991924436037873799460772225417096716495790L), static_cast<T>(-0.412302587956398488083234054611461042034534834472404728823877L), static_cast<T>(0.618259020741691041406264291332475282915777945124146942159898L), static_cast<T>(0.278795166921169522685097569410983241403000593451631000239732L) }},
|
||||
{{ -3.5, static_cast<T>(-0.375533823140431911934396951580170239543268576378264063902563L), static_cast<T>(0.168939837481058611843442769540943269911562243926304070915824L), static_cast<T>(-0.343443433454048146287937374098698857094194220958713294264017L), static_cast<T>(-0.693116284907288801752443612670580462699702668014978495343697L) }},
|
||||
{{ -30.25, static_cast<T>(-0.236900428491559731119806902381433570300271552218956227857722L), static_cast<T>(0.0418614989839147441219283537268101850442118139150748075124111L), static_cast<T>(-0.232197332372689274917364138870840123428255785603863926579897L), static_cast<T>(-1.30261375952554697768880873095691151213006925411329957440342L) }},
|
||||
{{ -300.5, static_cast<T>(-0.117584304761702008955433457721670950077867326839023449546057L), static_cast<T>(0.0673518035440918806545676478730240310819758211028871823560384), static_cast<T>(-1.16763702262473888724431076711846459336993902544926162874376L), static_cast<T>(-2.03826035550300900666977975504950803669545593208969273694133L) }},
|
||||
{{ -300.5, static_cast<T>(-0.117584304761702008955433457721670950077867326839023449546057L), static_cast<T>(0.0673518035440918806545676478730240310819758211028871823560384L), static_cast<T>(-1.16763702262473888724431076711846459336993902544926162874376L), static_cast<T>(-2.03826035550300900666977975504950803669545593208969273694133L) }},
|
||||
}};
|
||||
|
||||
T tol = boost::math::tools::epsilon<T>() * 800;
|
||||
if (std::numeric_limits<T>::digits > 100)
|
||||
tol *= 2;
|
||||
for(unsigned i = 0; i < data.size(); ++i)
|
||||
{
|
||||
BOOST_CHECK_CLOSE_FRACTION(data[i][1], boost::math::airy_ai(data[i][0]), tol);
|
||||
|
||||
@@ -234,6 +234,30 @@ void expected_results()
|
||||
".*(JN|j).*|.*Tricky.*", // test data group
|
||||
".*", 33000, 20000); // test function
|
||||
}
|
||||
else if (std::numeric_limits<long double>::digits >= 90)
|
||||
{
|
||||
add_expected_result(
|
||||
".*", // compiler
|
||||
".*", // stdlib
|
||||
".*", // platform
|
||||
"double", // test type(s)
|
||||
".*J0.*Tricky.*", // test data group
|
||||
".*", 100000, 100000); // test function
|
||||
add_expected_result(
|
||||
".*", // compiler
|
||||
".*", // stdlib
|
||||
".*", // platform
|
||||
"double", // test type(s)
|
||||
".*J1.*Tricky.*", // test data group
|
||||
".*", 70, 50); // test function
|
||||
add_expected_result(
|
||||
".*", // compiler
|
||||
".*", // stdlib
|
||||
".*", // platform
|
||||
"double", // test type(s)
|
||||
".*Mathworld.*", // test data group
|
||||
".*", 20, 10); // test function
|
||||
}
|
||||
#endif
|
||||
add_expected_result(
|
||||
".*", // compiler
|
||||
|
||||
@@ -183,6 +183,16 @@ void expected_results()
|
||||
".*Yv.*", // test data group
|
||||
".*", 80, 70); // test function
|
||||
}
|
||||
else if (std::numeric_limits<long double>::digits >= 90)
|
||||
{
|
||||
add_expected_result(
|
||||
".*", // compiler
|
||||
".*", // stdlib
|
||||
".*", // platform
|
||||
"double", // test type(s)
|
||||
".*Yv.*Mathworld.*", // test data group
|
||||
".*", 20, 5); // test function
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// defaults are based on MSVC-8 on Win32:
|
||||
|
||||
@@ -98,6 +98,10 @@ void test_spots(T)
|
||||
BOOST_CHECK_CLOSE(::boost::math::beta(small, static_cast<T>(4)), 1/small, tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::beta(static_cast<T>(4), small), 1/small, tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::beta(static_cast<T>(4), static_cast<T>(20)), static_cast<T>(0.00002823263692828910220214568040654997176736L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::beta(static_cast<T>(0.0125L), static_cast<T>(0.000023L)), static_cast<T>(43558.24045647538375006349016083320744662L), tolerance * 2);
|
||||
if (std::numeric_limits<T>::digits < 100)
|
||||
{
|
||||
// Inexact input, so disable for ultra precise long doubles:
|
||||
BOOST_CHECK_CLOSE(::boost::math::beta(static_cast<T>(0.0125L), static_cast<T>(0.000023L)), static_cast<T>(43558.24045647538375006349016083320744662L), tolerance * 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,16 @@ void expected_results()
|
||||
"real_concept", // test type(s)
|
||||
".*Half.*", // test data group
|
||||
".*", 15, 10); // test function
|
||||
if (std::numeric_limits<long double>::digits > 100)
|
||||
{
|
||||
add_expected_result(
|
||||
".*", // compiler
|
||||
".*", // stdlib
|
||||
".*", // platform
|
||||
"real_concept", // test type(s)
|
||||
".*Near Zero.*", // test data group
|
||||
".*", 15, 10); // test function
|
||||
}
|
||||
add_expected_result(
|
||||
".*", // compiler
|
||||
".*", // stdlib
|
||||
@@ -87,7 +97,7 @@ void test_spots(T, const char* t)
|
||||
BOOST_CHECK_CLOSE(::boost::math::digamma(static_cast<T>(0.5)), static_cast<T>(-1.9635100260214234794409763329987555671931596046604L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::digamma(static_cast<T>(1)), static_cast<T>(-0.57721566490153286060651209008240243104215933593992L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::digamma(static_cast<T>(1.5)), static_cast<T>(0.036489973978576520559023667001244432806840395339566L), tolerance * 40);
|
||||
BOOST_CHECK_CLOSE(::boost::math::digamma(static_cast<T>(1.5) - static_cast<T>(1)/32), static_cast<T>(0.00686541147073577672813890866512415766586241385896200579891429L), tolerance * 100);
|
||||
BOOST_CHECK_CLOSE(::boost::math::digamma(static_cast<T>(1.5) - static_cast<T>(1)/32), static_cast<T>(0.00686541147073577672813890866512415766586241385896200579891429L), tolerance * 200);
|
||||
BOOST_CHECK_CLOSE(::boost::math::digamma(static_cast<T>(2)), static_cast<T>(0.42278433509846713939348790991759756895784066406008L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::digamma(static_cast<T>(8)), static_cast<T>(2.0156414779556099965363450527747404261006978069172L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::digamma(static_cast<T>(12)), static_cast<T>(2.4426616799758120167383652547949424463027180089374L), tolerance);
|
||||
|
||||
@@ -53,6 +53,16 @@ void expected_results()
|
||||
largest_type = "(long\\s+)?double";
|
||||
#endif
|
||||
|
||||
if (std::numeric_limits<long double>::digits > 100)
|
||||
{
|
||||
add_expected_result(
|
||||
".*", // compiler
|
||||
".*", // stdlib
|
||||
".*", // platform
|
||||
"long double|real_concept", // test type(s)
|
||||
".*Mathworld.*", // test data group
|
||||
".*", 40, 10); // test function
|
||||
}
|
||||
//
|
||||
// Catch all cases come last:
|
||||
//
|
||||
|
||||
@@ -44,6 +44,7 @@ T naive_falling_factorial(T x, unsigned n)
|
||||
template <class T>
|
||||
void test_spots(T)
|
||||
{
|
||||
using std::ldexp;
|
||||
//
|
||||
// Basic sanity checks.
|
||||
//
|
||||
|
||||
@@ -57,7 +57,7 @@ void test_hankel(T, const char* name)
|
||||
{{ 4, 4, static_cast<T>(0.281129064961360106322277160229942806897088617059328870629222L), static_cast<T>(-0.488936768533842510615657398339913206218740182079627974737267L) }},
|
||||
{{ 4, -4, static_cast<T>(0.281129064961360106322277160229942806897088617059328870629222L), std::complex<T>(static_cast<T>(-0.488936768533842510615657398339913206218740182079627974737267L), static_cast<T>(0.562258129922720212644554320459885613794177234118657741258443L)) }},
|
||||
{{ -4, 4, static_cast<T>(0.281129064961360106322277160229942806897088617059328870629222L), static_cast<T>(-0.488936768533842510615657398339913206218740182079627974737267L) }},
|
||||
{{ -4, -4, static_cast<T>(0.281129064961360106322277160229942806897088617059328870629222), std::complex<T>(static_cast<T>(-0.488936768533842510615657398339913206218740182079627974737267), static_cast<T>(0.562258129922720212644554320459885613794177234118657741258443L)) }},
|
||||
{{ -4, -4, static_cast<T>(0.281129064961360106322277160229942806897088617059328870629222), std::complex<T>(static_cast<T>(-0.488936768533842510615657398339913206218740182079627974737267L), static_cast<T>(0.562258129922720212644554320459885613794177234118657741258443L)) }},
|
||||
{{ 3, 3, static_cast<T>(0.309062722255251643618260194946833149429135935993056794354475L), static_cast<T>(-0.538541616105031618004703905338594463807957863604859251481262L) }},
|
||||
{{ 3, -3, static_cast<T>(-0.309062722255251643618260194946833149429135935993056794354475L), std::complex<T>(static_cast<T>(0.538541616105031618004703905338594463807957863604859251481262L), static_cast<T>(-0.618125444510503287236520389893666298858271871986113588708949L)) }},
|
||||
{{ -3, 3, static_cast<T>(-0.309062722255251643618260194946833149429135935993056794354475L), static_cast<T>(0.538541616105031618004703905338594463807957863604859251481262L) }},
|
||||
|
||||
@@ -140,6 +140,8 @@ void test_spots(T)
|
||||
// Spot values are from http://functions.wolfram.com/webMathematica/FunctionEvaluation.jsp?name=BetaRegularized
|
||||
// using precision of 50 decimal digits.
|
||||
T tolerance = boost::math::tools::epsilon<T>() * 3000;
|
||||
if (boost::math::tools::digits<T>() > 100)
|
||||
tolerance *= 2;
|
||||
BOOST_CHECK_CLOSE(
|
||||
::boost::math::ibeta(
|
||||
static_cast<T>(159) / 10000, //(0.015964560210704803L),
|
||||
|
||||
@@ -214,8 +214,8 @@ void test_spots(T)
|
||||
}
|
||||
if(std::numeric_limits<T>::max_exponent >= 1024)
|
||||
{
|
||||
BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast<T>(170), static_cast<T>(165)), static_cast<T>(2.737338337642022829223832094019477918166996032112404370e304L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast<T>(170), static_cast<T>(165)), static_cast<T>(1.531729671362682445715419794880088619901822603944331733e304L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast<T>(170), static_cast<T>(165)), static_cast<T>(2.737338337642022829223832094019477918166996032112404370e304L), 3 * tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast<T>(170), static_cast<T>(165)), static_cast<T>(1.531729671362682445715419794880088619901822603944331733e304L), 3 * tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast<T>(170), static_cast<T>(170)), static_cast<T>(2.090991698081449410761040647015858316167077909285580375e304L), 10 * tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast<T>(170), static_cast<T>(170)), static_cast<T>(2.178076310923255864178211241883708221901740726771155728e304L), 10 * tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast<T>(170), static_cast<T>(190)), static_cast<T>(2.8359275512790301602903689596273175148895758522893941392e303L), 10 * tolerance);
|
||||
|
||||
@@ -174,9 +174,9 @@ void test_spots(T, const char*)
|
||||
if(0 != ldexp(T(1), -1074))
|
||||
{
|
||||
// This is denorm_min at double precision:
|
||||
BOOST_CHECK_CLOSE_FRACTION(boost::math::tgamma_ratio(T(ldexp(T(1), -1074)), T(200)), T(5.13282785052571536804189023927976812551830809667482691717029e-50), tol * 50);
|
||||
BOOST_CHECK_CLOSE_FRACTION(boost::math::tgamma_ratio(T(200), T(ldexp(T(1), -1074))), T(1.94824379293682687942882944294875087145333536754699303593931e49), tol * 10);
|
||||
BOOST_CHECK_CLOSE_FRACTION(boost::math::tgamma_delta_ratio(T(ldexp(T(1), -1074)), T(200)), T(5.13282785052571536804189023927976812551830809667482691717029e-50), tol * 10);
|
||||
BOOST_CHECK_CLOSE_FRACTION(boost::math::tgamma_ratio(T(ldexp(T(1), -1074)), T(200)), T(5.13282785052571536804189023927976812551830809667482691717029e-50L), tol * 50);
|
||||
BOOST_CHECK_CLOSE_FRACTION(boost::math::tgamma_ratio(T(200), T(ldexp(T(1), -1074))), T(1.94824379293682687942882944294875087145333536754699303593931e49L), tol * 10);
|
||||
BOOST_CHECK_CLOSE_FRACTION(boost::math::tgamma_delta_ratio(T(ldexp(T(1), -1074)), T(200)), T(5.13282785052571536804189023927976812551830809667482691717029e-50L), tol * 10);
|
||||
BOOST_CHECK_CLOSE_FRACTION(boost::math::tgamma_delta_ratio(T(200), T(ldexp(T(1), -1074))), T(1), tol);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ void test_spots(T, const char* t)
|
||||
BOOST_CHECK_CLOSE(::boost::math::zeta(ldexp(static_cast<T>(1), -27)), static_cast<T>(-0.500000006846625660947956426350389518286874288247134329498289L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::zeta(ldexp(static_cast<T>(1), -28)), static_cast<T>(-0.500000003423312816552083476988056486473169377162409806781384L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::zeta(ldexp(static_cast<T>(1), -29)), static_cast<T>(-0.500000001711656404795568073849512135664960180586820144333542L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::zeta(ldexp(static_cast<T>(1), -30)), static_cast<T>(-0.500000000855828201527665623188910582717329375986726355164261L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::zeta(ldexp(static_cast<T>(1), -30)), static_cast<T>(-0.500000000855828201527665623188910582717329375986726355164261L), tolerance * 2);
|
||||
BOOST_CHECK_CLOSE(::boost::math::zeta(ldexp(static_cast<T>(1), -31)), static_cast<T>(-0.500000000427914100546303208463654361814800355929815322493143L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::zeta(ldexp(static_cast<T>(1), -32)), static_cast<T>(-0.500000000213957050218769203487022003676593508474107873788445L), tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::zeta(ldexp(static_cast<T>(1), -33)), static_cast<T>(-0.500000000106978525095789001562046589421133388262409441738089L), tolerance);
|
||||
|
||||
Reference in New Issue
Block a user