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

only solve problems if have enough precision #1004

Merged
merged 1 commit into from
Jul 31, 2023

Conversation

ryanelandt
Copy link
Contributor

@ryanelandt ryanelandt commented Jul 25, 2023

This is chunk 3 for #1000

In the ibeta_inverse.hpp file, there exists root-finding problems of the form:

log(x)  + a * log(1 - x) + t

This function has an extrema at 1 / (1 + a).

Newton solver finds dubious roots

For extreme values of a, the extrema evaluates to 0 or 1 due to floating point limitations. For these cases, the objectives function evaluation always has the same sign, and is never zero. The Newton solver finds a root for the reasons described in #1005.

This PR

  • Uses if (cross == 0 || cross == 1) { return cross; } to return early for values that lack the numerical precision to construct a meaningful objective function
  • Adds a BOOST_MATH_ASSERT to prevent the construction of root finding problems that are problematic.

@mborland
Copy link
Member

I'll look into the CI system to see what's going on with the TSAN failures across all of your PRs, but it is clearly unrelated.

@mborland mborland merged commit 50ef83a into boostorg:develop Jul 31, 2023
56 checks passed
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.

3 participants