[issue25177] OverflowError in statistics.mean when summing large floats
Bar Harel
report at bugs.python.org
Sat Sep 19 20:58:01 CEST 2015
Bar Harel added the comment:
Seems like this is the only viable option. It fixes the OverflowError but comes at the cost of precision and time.
Another option would be to try/except the overflow error and only then return the slower method.
Regarding the data [8.988465674311579e+307, 8.98846567431158e+307], float has lesser precision than other types like Decimal so the patched method would return 8.98846567431158e+307.
A dataset to test the fix is [8.99e+307, 8.989e+307] which gives a correct result.
----------
keywords: +patch
Added file: http://bugs.python.org/file40519/issue25177.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25177>
_______________________________________
More information about the Python-bugs-list
mailing list