Bug report
Bug description:
Documented behaviour: The median() docstring states: "When the number of data points is even, the median is interpolated by taking the average of the two middle values".
Expected: statistics.median([1e308, 1e308]) returns 1e308.
Actual: Returns inf.
import math, statistics
data = [1e308, 1e308]
if not all(math.isfinite(x) and x > 0 for x in data):
print("REFUTATION REJECTED: input is not finite positive numeric data")
else:
actual = statistics.median(data)
expected = data[0] / 2 + data[1] / 2
if actual != expected:
print("REFUTATION CONFIRMED:", data, "actual:", actual, "expected:", expected)
else:
print("REFUTATION REJECTED: actual equals the documented average")
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library statistics:
REFUTATION CONFIRMED: [1e+308, 1e+308] actual: inf expected: 1e+308
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-045701-c4
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
Documented behaviour: The median() docstring states: "When the number of data points is even, the median is interpolated by taking the average of the two middle values".
Expected: statistics.median([1e308, 1e308]) returns 1e308.
Actual: Returns 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-045701-c4
CPython versions tested on:
3.14
Operating systems tested on:
Windows