[issue20499] Rounding errors with statistics.variance

Wolfgang Maier report at bugs.python.org
Fri Feb 7 13:44:58 CET 2014


Wolfgang Maier added the comment:

> We can add a fast Decimal.as_integer_ratio() in C.

That would be a terrific thing to have !! Currently, Decimals perform really poorly with the statistics functions and this is entirely due to this bottleneck.

With regard to calculating the sum of Decimals in decimal arithmetic, the problem is how you'd detect that the input is all Decimals (or contains enough Decimals to justify a switch in the algorithm).
The current statistics module, accepts input data consisting of mixed types, e.g., you could have Decimal mixed with ints or floats. Much of the complexity of the module stems from this fact. You can also read about some of the complications under this issue: http://bugs.python.org/issue20481 .

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20499>
_______________________________________


More information about the Python-bugs-list mailing list