From ea70672db7f894d256dada5370539fa616bbb7c0 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 26 Nov 2022 09:20:37 +0000 Subject: [PATCH] Fix gcc -fno-exception build. --- include/boost/math/special_functions/detail/ibeta_inverse.hpp | 4 ++++ include/boost/math/tools/roots.hpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/boost/math/special_functions/detail/ibeta_inverse.hpp b/include/boost/math/special_functions/detail/ibeta_inverse.hpp index 90a94e644..9b7bb50b8 100644 --- a/include/boost/math/special_functions/detail/ibeta_inverse.hpp +++ b/include/boost/math/special_functions/detail/ibeta_inverse.hpp @@ -633,14 +633,18 @@ T ibeta_inv_imp(T a, T b, T p, T q, const Policy& pol, T* py) T bet = 0; if (b < 2) { +#ifndef BOOST_NO_EXCEPTIONS try +#endif { bet = boost::math::beta(a, b, pol); } +#ifndef BOOST_NO_EXCEPTIONS catch (const std::overflow_error&) { bet = tools::max_value(); } +#endif } if(bet != 0) { diff --git a/include/boost/math/tools/roots.hpp b/include/boost/math/tools/roots.hpp index ccf908f21..6493e8122 100644 --- a/include/boost/math/tools/roots.hpp +++ b/include/boost/math/tools/roots.hpp @@ -543,15 +543,19 @@ namespace detail { last_f0 = f0; delta2 = delta1; delta1 = delta; +#ifndef BOOST_NO_EXCEPTIONS try +#endif { detail::unpack_tuple(f(result), f0, f1, f2); } +#ifndef BOOST_NO_EXCEPTIONS catch (const std::overflow_error&) { f0 = max > 0 ? tools::max_value() : -tools::min_value(); f1 = f2 = 0; } +#endif --count; BOOST_MATH_INSTRUMENT_VARIABLE(f0);