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

Merge for 1.86 #628

Merged
merged 8 commits into from
Jul 2, 2024
Merged

Merge for 1.86 #628

merged 8 commits into from
Jul 2, 2024

Conversation

mborland
Copy link
Member

@mborland mborland commented Jul 2, 2024

No description provided.

mborland and others added 8 commits April 24, 2024 08:25
Improve codecov reliability
this change is a follow-up of d51f2e9. it intends to
address the exception thrown in a noexcept functon.

a minimal reproducer looks like

```c++

int main() {
    std::string s = "32767456456456456456545678943512357658768763546575675";
    boost::multiprecision::cpp_int num(s);
    std::cout << num.convert_to<float>() << std::endl;
}
```

since boost 1.79, the code above terminates like
```
Program returned: 139
Program stderr
terminate called after throwing an instance of 'boost::wrapexcept<std::domain_error>'
  what():  Error in function float_next<float>(float): Argument must be finite, but got inf
Program terminated with signal: SIGSEGV
```

because `float_next_imp()` throws 'boost::wrapexcept<std::domain_error>'
if the number is NAN of INF. and `eval_convert_to()` is marked as
`noexcept(boost::multiprecision::detail::is_arithmetic<R>::value &&
          std::numeric_limits<R>::has_infinity)`,
but only `overflow_error` is ignored in the policy passed to
`float_next()`.

so, in this change, `std::domain_error` is ignored as well, so that
``num.convert_to<float>()` returns a NaN in this case.

Refs #553

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
make sure eval_convert_to() do not terminate with super large number
Correct divide-by-zero in cpp_int modulus operations.
Also added some more efficient operator overloads for the trivial case.
Fixes #624
Ensure checked integers are in a sane state after a throw.
Document that the value of the target operand is unspecified after a throw.
Improve testing.
Fixes #626
@mborland mborland merged commit 2a698c7 into master Jul 2, 2024
153 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