Bug report
Bug description:
Documented behaviour: The supplied public API documents inv_cdf as "Inverse cumulative distribution function. x : P(X <= x) = p". For a normal distribution, the specified quantile is mu + sigma times the standard-normal quantile.
Expected: A finite quantile approximately 9.119657853130516e307, agreeing with a * (NormalDist().inv_cdf(0.975) - 1) within relative tolerance 1e-14.
Actual: inf
import math
import statistics
a = 9.5e307
data = dict(a=a, mu=-a, sigma=a, p=0.975)
if not (9.5e307 <= a <= 1e308 and
all(math.isfinite(v) for v in data.values()) and
data["sigma"] > 0 and 0 < data["p"] < 1):
print("REFUTATION REJECTED:", "invalid input", data)
else:
lo, hi = 0.0, 10.0
for _ in range(80):
z = (lo + hi) / 2
if math.erfc(-z / math.sqrt(2)) / 2 < data["p"]:
lo = z
else:
hi = z
expected = a * ((lo + hi) / 2 - 1)
try:
actual = statistics.NormalDist(data["mu"], data["sigma"]).inv_cdf(data["p"])
broken = not math.isfinite(actual) or not math.isclose(
actual, expected, rel_tol=1e-14, abs_tol=0)
except Exception as exc:
actual, broken = repr(exc), True
if broken:
print("REFUTATION CONFIRMED:", data, "actual =", actual, "expected =", expected)
else:
print("REFUTATION REJECTED:", "finite result agrees within tolerance",
data, "actual =", actual, "expected =", expected)
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library statistics:
REFUTATION CONFIRMED: {'a': 9.5e+307, 'mu': -9.5e+307, 'sigma': 9.5e+307, 'p': 0.975} actual = inf expected = 9.119657853130516e+307
This report was found and written by an automated property-testing tool I run (bugforge). The reproducer above was executed and its output is pasted unedited; no person reviewed the report before it was filed. The search script is in https://github.com/augusto-rehfeldt/bugforge-results/tree/main/statistics-20261003-124541-c2
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
Documented behaviour: The supplied public API documents inv_cdf as "Inverse cumulative distribution function. x : P(X <= x) = p". For a normal distribution, the specified quantile is mu + sigma times the standard-normal quantile.
Expected: A finite quantile approximately 9.119657853130516e307, agreeing with a * (NormalDist().inv_cdf(0.975) - 1) within relative tolerance 1e-14.
Actual: inf
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library
statistics:This report was found and written by an automated property-testing tool I run (bugforge). The reproducer above was executed and its output is pasted unedited; no person reviewed the report before it was filed. The search script is in https://github.com/augusto-rehfeldt/bugforge-results/tree/main/statistics-20261003-124541-c2
CPython versions tested on:
3.14
Operating systems tested on:
Windows