From 5f069ffd3b1e86977e48b3c714eeb9250f67a4f0 Mon Sep 17 00:00:00 2001 From: mckib2 Date: Sat, 16 Jul 2022 09:57:58 -0700 Subject: [PATCH 1/2] ENH: add upstream patch (for commit 8f30fb8d7ef13b543bc8f988ce9ba783d833432 to fix ibeta_derivative underflow issue --- ...p-prevent-ibeta_derivative-underflow-error.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 patches/0002-beta.hpp-prevent-ibeta_derivative-underflow-error.patch diff --git a/patches/0002-beta.hpp-prevent-ibeta_derivative-underflow-error.patch b/patches/0002-beta.hpp-prevent-ibeta_derivative-underflow-error.patch new file mode 100644 index 000000000..c02bbb6fa --- /dev/null +++ b/patches/0002-beta.hpp-prevent-ibeta_derivative-underflow-error.patch @@ -0,0 +1,13 @@ +diff --git a/boost/math/special_functions/beta.hpp b/include/boost/math/special_functions/beta.hpp +index 87e8950dc..f74937c1a 100644 +--- a/boost/math/special_functions/beta.hpp ++++ b/boost/math/special_functions/beta.hpp +@@ -390,7 +390,7 @@ T ibeta_power_terms(T a, + else + { + T p1 = pow(b1, a / b); +- T l3 = (log(p1) + log(b2)) * b; ++ T l3 = (p1 != 0) && (b2 != 0) ? (log(p1) + log(b2)) * b : tools::max_value(); // arbitrary large value if the logs would fail! + if((l3 < tools::log_max_value()) + && (l3 > tools::log_min_value())) + { From 7e860b2008f1ff2e2d68563c2053ee0b11ab2881 Mon Sep 17 00:00:00 2001 From: mckib2 Date: Sat, 16 Jul 2022 09:58:30 -0700 Subject: [PATCH 2/2] FIX: regenerate headers with new patch 0002 applied --- boost/math/special_functions/beta.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boost/math/special_functions/beta.hpp b/boost/math/special_functions/beta.hpp index 90977dab0..830de9d30 100644 --- a/boost/math/special_functions/beta.hpp +++ b/boost/math/special_functions/beta.hpp @@ -390,7 +390,7 @@ T ibeta_power_terms(T a, else { T p1 = pow(b1, a / b); - T l3 = (log(p1) + log(b2)) * b; + T l3 = (p1 != 0) && (b2 != 0) ? (log(p1) + log(b2)) * b : tools::max_value(); // arbitrary large value if the logs would fail! if((l3 < tools::log_max_value()) && (l3 > tools::log_min_value())) {