Message251108
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.) |
|
Date |
User |
Action |
Args |
2015-09-19 19:29:15 | mark.dickinson | set | recipients:
+ mark.dickinson, benjamin.peterson, steven.daprano, David MacIver, bar.harel |
2015-09-19 19:29:15 | mark.dickinson | set | messageid: <1442690955.44.0.771600760834.issue25177@psf.upfronthosting.co.za> |
2015-09-19 19:29:15 | mark.dickinson | link | issue25177 messages |
2015-09-19 19:29:15 | mark.dickinson | create | |
|