Skip to content

Commit

Permalink
BUG: fix nan output of special.betaincinv (scipy#21678)
Browse files Browse the repository at this point in the history
undefined
  • Loading branch information
dschmitz89 authored Oct 10, 2024
1 parent 4ef4162 commit 0396bdd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scipy/_lib/boost_math
Submodule boost_math updated 814 files
8 changes: 8 additions & 0 deletions scipy/special/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,14 @@ def test_betainc_domain_errors(self, func, args):
with pytest.raises(special.SpecialFunctionError, match='domain'):
special.betainc(*args)

@pytest.mark.parametrize('dtype', [np.float32, np.float64])
def test_gh21426(self, dtype):
# Test for gh-21426: betaincinv must not return NaN
a = np.array([5.], dtype=dtype)
x = np.array([0.5], dtype=dtype)
result = special.betaincinv(a, a, x)
assert_allclose(result, x, rtol=10 * np.finfo(dtype).eps)


class TestCombinatorics:
def test_comb(self):
Expand Down

0 comments on commit 0396bdd

Please sign in to comment.