Skip to content

Commit

Permalink
Merge pull request #1226 from boostorg/double_double_batch_01
Browse files Browse the repository at this point in the history
First batch changes double-fp-backend
  • Loading branch information
ckormanyos authored Dec 19, 2024
2 parents 699d79b + bf7fb37 commit d026468
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/boost/math/special_functions/detail/bessel_k0.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ BOOST_MATH_GPU_ENABLED T bessel_k0_imp(const T& x, const boost::math::integral_c
BOOST_MATH_BIG_CONSTANT(T, 113, 8.370574966987293592457152146806662562e+03),
BOOST_MATH_BIG_CONSTANT(T, 113, 4.871254714311063594080644835895740323e+01)
};
if(x < tools::log_max_value<T>())
if(-x > tools::log_min_value<T>())
return ((tools::evaluate_rational(P, Q, T(1 / x)) + Y) * exp(-x) / sqrt(x));
else
{
Expand Down
4 changes: 2 additions & 2 deletions include/boost/math/tools/precision.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ struct log_limit_noexcept_traits : public log_limit_noexcept_traits_imp<T, boost
#endif

template <class T>
BOOST_MATH_GPU_ENABLED inline constexpr T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits<T>::value)
BOOST_MATH_GPU_ENABLED inline T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits<T>::value)
{
#ifndef BOOST_MATH_HAS_NVRTC
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
Expand All @@ -223,7 +223,7 @@ BOOST_MATH_GPU_ENABLED inline constexpr T log_max_value(BOOST_MATH_EXPLICIT_TEMP
}

template <class T>
BOOST_MATH_GPU_ENABLED inline constexpr T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits<T>::value)
BOOST_MATH_GPU_ENABLED inline T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(detail::log_limit_noexcept_traits<T>::value)
{
#ifndef BOOST_MATH_HAS_NVRTC
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
Expand Down
6 changes: 3 additions & 3 deletions test/cubic_roots_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,16 @@ template <class Real> void test_zero_coefficients() {

auto roots = cubic_roots(a, b, c, d);
// I could check the condition number here, but this is fine right?
if (!CHECK_ULP_CLOSE(r[0], roots[0], (std::numeric_limits<Real>::digits > 100 ? 120 : 25))) {
if (!CHECK_ULP_CLOSE(r[0], roots[0], (std::numeric_limits<Real>::digits > 100 ? 120 : 60))) {
std::cerr << " Polynomial x^3 + " << b << "x^2 + " << c << "x + "
<< d << " has roots {";
std::cerr << r[0] << ", " << r[1] << ", " << r[2]
<< "}, but the computed roots are {";
std::cerr << roots[0] << ", " << roots[1] << ", " << roots[2]
<< "}\n";
}
CHECK_ULP_CLOSE(r[1], roots[1], 25);
CHECK_ULP_CLOSE(r[2], roots[2], (std::numeric_limits<Real>::digits > 100 ? 120 : 25));
CHECK_ULP_CLOSE(r[1], roots[1], 80);
CHECK_ULP_CLOSE(r[2], roots[2], (std::numeric_limits<Real>::digits > 100 ? 120 : 80));
for (auto root : roots) {
auto res = cubic_root_residual(a, b, c, d, root);
CHECK_LE(abs(res[0]), res[1]);
Expand Down
4 changes: 2 additions & 2 deletions test/linear_regression_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ void test_scaling_relations()
Real c1_lambda = std::get<1>(temp);
Real Rsquared_lambda = std::get<2>(temp);

CHECK_ULP_CLOSE(lambda*c0, c0_lambda, 50);
CHECK_ULP_CLOSE(lambda*c0, c0_lambda, 70);
CHECK_ULP_CLOSE(lambda*c1, c1_lambda, 30);
CHECK_ULP_CLOSE(Rsquared, Rsquared_lambda, 3);

Expand All @@ -241,7 +241,7 @@ void test_scaling_relations()
Real c1_ = std::get<1>(temp);
Real Rsquared_ = std::get<2>(temp);

CHECK_ULP_CLOSE(c0, c0_, 70);
CHECK_ULP_CLOSE(c0, c0_, 100);
CHECK_ULP_CLOSE(c1, c1_*lambda, 50);
CHECK_ULP_CLOSE(Rsquared, Rsquared_, 50);

Expand Down
4 changes: 2 additions & 2 deletions test/quartic_roots_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ void test_zero_coefficients()

roots = quartic_roots(a, b, c, d, e);
// I could check the condition number here, but this is fine right?
CHECK_ULP_CLOSE(r[0], roots[0], 160);
CHECK_ULP_CLOSE(r[1], roots[1], 260);
CHECK_ULP_CLOSE(r[0], roots[0], 340);
CHECK_ULP_CLOSE(r[1], roots[1], 440);
CHECK_ULP_CLOSE(r[2], roots[2], 220);
CHECK_ULP_CLOSE(r[3], roots[3], 160);
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_bessel_i.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void test_bessel(T, const char* name)
BOOST_CHECK_CLOSE_FRACTION(boost::math::cyl_bessel_i(T(0.5), T(11357)), SC_(7.173138695269929329584326974917488634629578339622112563648e4929), tolerance * mul);
}
#endif
BOOST_IF_CONSTEXPR (std::numeric_limits<T>::max_exponent > 1000)
BOOST_IF_CONSTEXPR (std::numeric_limits<T>::max_exponent10 > 304)
{
BOOST_IF_CONSTEXPR(std::is_floating_point<T>::value == false)
tolerance *= 4; // multiprecision type.
Expand Down

0 comments on commit d026468

Please sign in to comment.