boostorg / boostorg/math

Negative Binomial CDF and Quantile do not always roundtrip

オープン
#935 コメント 25 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
374
フォーク
264
平均マージ
1日 23時間
マージ済み PR(30日)
17

説明

Failure can be found here: https://github.com/scipy/scipy/pull/17432/checks?check_run_id=10961417302
Found on PR: https://github.com/scipy/scipy/pull/17432

Minimal reproducer:

```
import numpy as np
import numpy.testing as npt
from scipy import stats

dist = stats.nbinom(5, 0.5)
supp = 6
cdf_supp = dist.cdf(supp) # ideally 0.7255859375
cdf_supp0 = cdf_supp - 10*np.spacing(cdf_supp) # 0.7255859374999989
npt.assert_array_equal(dist.ppf(cdf_supp0), supp) # both should be 6
```

Note in their code says:

In very rare cases, the finite precision calculation of ppf(cdf(supp))
can produce an array in which an element is off by one. We nudge the
CDF values down by 10 ULPs help to avoid this.

At 15 ULPs it seems to be correct.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。