Skip to content

Commit

Permalink
BUG: special: Fix handling of powm1 overflow errors (scipy#17855)
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland authored and tylerjereddy committed Feb 18, 2023
1 parent 6931375 commit 04e26b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scipy/special/boost_special_functions.h
Expand Up @@ -90,7 +90,12 @@ Real powm1_wrap(Real x, Real y)
z = NAN;
} catch (const std::overflow_error& e) {
sf_error("powm1", SF_ERROR_OVERFLOW, NULL);
z = INFINITY;
if (x > 0) {
z = INFINITY;
}
else {
z = -INFINITY;
}
} catch (const std::underflow_error& e) {
sf_error("powm1", SF_ERROR_UNDERFLOW, NULL);
z = 0;
Expand Down

0 comments on commit 04e26b6

Please sign in to comment.