Skip to content

Commit

Permalink
BUG: special: Fix handling of powm1 overflow errors (#17855)
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Jan 26, 2023
1 parent 0243a96 commit e63cc01
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 e63cc01

Please sign in to comment.