Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue 845 #846

Merged
merged 2 commits into from
Oct 17, 2022
Merged

Fix for issue 845 #846

merged 2 commits into from
Oct 17, 2022

Conversation

mborland
Copy link
Member

@mborland mborland commented Oct 16, 2022

Avoid division by zero in special cases

xref: scipy/scipy#17101

Avoid division by zero in special cases
@@ -86,7 +86,12 @@ namespace boost
}
pois *= i / l2;
beta += xterm;
xterm *= (a + i - 1) / (x * (a + b + i - 2));

if (a + b + i != 2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than putting an if inside the inner loop, it would be better to move calculation of xterm to the start of the loop: albeit it's inconvenient, and we have to be careful to get the algebra right ;)

Again this should wait till after the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

non_central_f pdf and cdf leave FE_DIVBYZERO or FE_INVALID flags set in some cases.
3 participants