Skip to content

BUG: random: np.random.weibull(a=0) sometimes returns inf. #12371

@WarrenWeckesser

Description

@WarrenWeckesser

Over in #8056, there was a test failure that appears to be a numpy bug. The test that is failing is TestRandomDist.test_weibull_0, which is:

def test_weibull_0(self):
    assert_equal(np.random.weibull(a=0), 0)
    assert_raises(ValueError, np.random.weibull, a=-0.)

The assertion assert_equal(np.random.weibull(a=0), 0) is failing, because sometimes np.random.weibull(a=0) returns inf:

In [36]: np.__version__
Out[36]: '1.15.4'

In [37]: np.random.seed(123)

In [38]: np.random.weibull(a=0, size=10)
Out[38]: array([inf,  0.,  0.,  0., inf,  0., inf, inf,  0.,  0.])

Those inf values should not be there. I get the same result with the current master branch, '1.16.0.dev0+e34f5bb'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions