boostorg / boostorg/boost

boost non_central_chi_squared_distribution() exception.

Open
#577 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
8.6k
Forks
1.9k
Avg merge
39m
Merged PRs (30d)
2

Description

The following code used to give correct result (1.53) but now (1.77) throws exception:

```
boost::math::non_central_chi_squared_distribution nchi2(0.001, 100);
double res = quantile(nchi2, 0.00000000000003659);

```
// use to return 5.8758639130601491, now throws exception

I traced the issue to line 476 in boost/math/distributions/non_central_chi_squared.hpp

instead

```
if(guess == 0)
guess = tools::min_value();
```
add the checking of guess for infinity fixes the issue

```
if(guess == 0 || isinf(guess))
guess = tools::min_value();
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.