Mark Dickinson added the comment:

That patch doesn't really help, I'm afraid, since it introduces problems at the 
other end of the floating-point range: for example, `mean([5e-324, 5e-324])` 
would give `0.0` with that patch (instead of the `5e-324` it currently gives).

So currently, when computing the mean of a sequence of floats (possibly mixed 
with ints), the code:

1. Computes the sum as a Fraction.
2. Converts that Fraction to a float.
3. Divides the result by the number of elements.

Reversing steps 2 and 3 here would solve the issue, but would require some 
refactoring.  It's really up to Steven whether he thinks that that refactoring 
is worth it for these corner cases at the extremes of the floating-point range. 
 (It's difficult to imagine that such numbers would turn up frequently in 
practical applications.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25177>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to