boostorg / boostorg/boost

boost non_central_chi_squared_distribution() exception.

Offen
#577 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
HTML
Sterne
8.6k
Forks
1.9k
Ø Merge
39 Min.
Gemergte PRs (30 T.)
2

Beschreibung

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();
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.