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 #927 #928

Closed
wants to merge 1 commit into from
Closed

Fix for issue #927 #928

wants to merge 1 commit into from

Conversation

mborland
Copy link
Member

Return -INF or +INF if the result is INF rather than throwing an overflow exception.

@mborland mborland marked this pull request as ready for review January 25, 2023 17:53
@mborland mborland linked an issue Jan 25, 2023 that may be closed by this pull request
@jzmaddock
Copy link
Collaborator

I think this is the wrong fix - and actually we are doing exactly what we promised to do here.

If you want the sign of the infinity rather than an exception, then use a Policy which ignores overflow errors and you will get a signed infinity back.

@mborland
Copy link
Member Author

What is the appropriate policy to use here to get the signed infinity?

@jzmaddock
Copy link
Collaborator

If it's project wide then

#define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error

or

#define BOOST_MATH_OVERFLOW_ERROR_POLICY errno_on_error

Depending on whether you want to be able to check errno for overflow.

If it's just this function, then:

using namespace boost::math::policies;

boost::math::specfun(arg, make_policy(overflow_error<errno_on_error>()));

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.

powm1 Returning Wrong INF
2 participants