[issue41421] Random.paretovariate sometimes raises ZeroDivisionError for small alpha

Tim Peters report at bugs.python.org
Sat Aug 1 17:07:18 EDT 2020


Tim Peters <tim at python.org> added the comment:

That text is fine, if you feel something needs to be said at all. I really don't. A Pareto distribution of this kind with parameter <= 1.0 has infinite expected value - VERY long tail. Anyone who knows what they're doing already knows that. The reason the implementation can't "blow up" for parameters >= (roughly) 0.1 isn't that IEEE doubles have such a large dynamic range but rather that they can't represent a number < 1.0 larger than 1 - 2**-53 (so u = 1 - random.random() is always at least 2**-53). The actual distribution has infinite expected value nonetheless, but the implementation is incapable of generating any of its very large values (which, while very rare, are also very large).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41421>
_______________________________________


More information about the Python-bugs-list mailing list