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

update beta error messages and checks #1003

Merged

Conversation

ryanelandt
Copy link
Contributor

This is chunk 2 for #1000.

Runtime errors
One approach to run-time errors takes the form:

if(!(boost::math::isfinite)(a))
   return policies::raise_domain_error<T>(function, "a is bad because reason (got a=%1%).", a, pol);

When using this approach, it's understood that the error message should agree with the check that is actually being performed.

This PR
This PR fixes 6 places where the check and stated error message lacked agreement in the beta.hpp file. These incorrect error messages make debugging the Newton solver take longer than it would have otherwise.

Ideas about future solutions
Disagreement between the check and the error message are too easy to make. I think a better solution on a high level would to be able to use the BOOST_TEST types macros for run-time checks. I don't know if this kind of thing is possible. But either way, that's out of the scope of this PR.

@ryanelandt ryanelandt mentioned this pull request Jul 25, 2023
@mborland
Copy link
Member

LGTM. You are correct that there are probably other places where other incorrect error messages are lingering. Thanks.

@mborland mborland merged commit fb0af63 into boostorg:develop Jul 31, 2023
56 checks passed
@ryanelandt
Copy link
Contributor Author

Thanks!

@ryanelandt ryanelandt deleted the update_beta_err_msg_and_checks branch July 31, 2023 14:10
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.

2 participants