mirror of
https://github.com/boostorg/math.git
synced 2026-02-26 16:52:27 +00:00
gamma.hpp coverage.
This commit is contained in:
@@ -281,7 +281,7 @@ void expected_results()
|
||||
//
|
||||
// Large exponent range causes more extreme test cases to be evaluated:
|
||||
//
|
||||
if(std::numeric_limits<long double>::max_exponent > std::numeric_limits<double>::max_exponent)
|
||||
BOOST_IF_CONSTEXPR(std::numeric_limits<long double>::max_exponent > std::numeric_limits<double>::max_exponent)
|
||||
{
|
||||
add_expected_result(
|
||||
"[^|]*", // compiler
|
||||
|
||||
@@ -202,7 +202,7 @@ void test_spots(T)
|
||||
|
||||
//typedef boost::math::policies::policy<boost::math::policies::overflow_error<boost::math::policies::throw_on_error> > throw_policy;
|
||||
|
||||
if(std::numeric_limits<T>::max_exponent <= 1024 && std::numeric_limits<T>::has_infinity)
|
||||
BOOST_IF_CONSTEXPR(std::numeric_limits<T>::max_exponent <= 1024 && std::numeric_limits<T>::has_infinity)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(::boost::math::tgamma(static_cast<T>(176), static_cast<T>(100)), std::numeric_limits<T>::infinity());
|
||||
//BOOST_MATH_CHECK_THROW(::boost::math::tgamma(static_cast<T>(176), static_cast<T>(100), throw_policy()), std::overflow_error);
|
||||
@@ -212,7 +212,7 @@ void test_spots(T)
|
||||
BOOST_CHECK_EQUAL(::boost::math::tgamma(static_cast<T>(740.5), static_cast<T>(2500)), std::numeric_limits<T>::infinity());
|
||||
BOOST_CHECK_EQUAL(::boost::math::tgamma_lower(static_cast<T>(10000.0f), static_cast<T>(10000.0f / 4)), std::numeric_limits<T>::infinity());
|
||||
}
|
||||
if(std::numeric_limits<T>::max_exponent >= 1024)
|
||||
BOOST_IF_CONSTEXPR(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), (std::numeric_limits<T>::digits > 100 ? 10 : 3) * tolerance);
|
||||
BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast<T>(170), static_cast<T>(165)), static_cast<T>(1.531729671362682445715419794880088619901822603944331733e304L), 3 * tolerance);
|
||||
@@ -254,5 +254,17 @@ void test_spots(T)
|
||||
//
|
||||
BOOST_CHECK_EQUAL(::boost::math::gamma_q(static_cast<T>(1770), static_cast<T>(1e-12)), 1);
|
||||
BOOST_CHECK_EQUAL(::boost::math::gamma_p(static_cast<T>(1770), static_cast<T>(1e-12)), 0);
|
||||
//
|
||||
// Coverage:
|
||||
//
|
||||
BOOST_CHECK_THROW(boost::math::gamma_p(static_cast<T>(-1), static_cast<T>(2)), std::domain_error);
|
||||
BOOST_CHECK_THROW(boost::math::gamma_q(static_cast<T>(-1), static_cast<T>(2)), std::domain_error);
|
||||
BOOST_CHECK_THROW(boost::math::gamma_p(static_cast<T>(1), static_cast<T>(-2)), std::domain_error);
|
||||
BOOST_CHECK_THROW(boost::math::gamma_q(static_cast<T>(1), static_cast<T>(-2)), std::domain_error);
|
||||
BOOST_CHECK_THROW(boost::math::gamma_p(static_cast<T>(0), static_cast<T>(2)), std::domain_error);
|
||||
BOOST_CHECK_THROW(boost::math::gamma_q(static_cast<T>(0), static_cast<T>(2)), std::domain_error);
|
||||
BOOST_CHECK_THROW(boost::math::gamma_p_derivative(static_cast<T>(-1), static_cast<T>(2)), std::domain_error);
|
||||
BOOST_CHECK_THROW(boost::math::gamma_p_derivative(static_cast<T>(1), static_cast<T>(-2)), std::domain_error);
|
||||
BOOST_CHECK_THROW(boost::math::gamma_p_derivative(static_cast<T>(0), static_cast<T>(2)), std::domain_error);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,5 +12,6 @@
|
||||
int main()
|
||||
{
|
||||
CHECK_EQUAL(boost::math::tgamma(-200.5), 0.0); // triggers internal exception handling
|
||||
CHECK_EQUAL(boost::math::gamma_p(500.125, 1e-50), 0.0); // triggers internal exception handling
|
||||
return boost::math::test::report_errors();
|
||||
}
|
||||
|
||||
@@ -180,4 +180,10 @@ void test_spots(T, const char*)
|
||||
BOOST_CHECK_CLOSE_FRACTION(boost::math::tgamma_delta_ratio(T(200), T(ldexp(T(1), -1074))), T(1), tol);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Coverage:
|
||||
//
|
||||
BOOST_CHECK_EQUAL(boost::math::tgamma_delta_ratio(T(2), T(0)), T(1))
|
||||
BOOST_CHECK_EQUAL(boost::math::tgamma_delta_ratio(T(200), T(0)), T(1))
|
||||
BOOST_CHECK_EQUAL(boost::math::tgamma_delta_ratio(T(2000), T(0)), T(1))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user