3 ms·
Thanks for thoughtful reply. But the Kahan method aside, the idea would be to start with the smallest numbers, not the largest.
by wglb 8y ago
Thanks for thoughtful reply.
But the Kahan method aside, the idea would be to start with the smallest numbers, not the largest.
- thaumasiotes 8y agoYes, I understand that. >> if you have a list of values of which some are very large and some are very small, sort-and-add will sum up all of the small numbers into one large number before adding that sum to another large number I don't quite follow the point you're making -- can you elaborate?
- hedora 8y agoIntuitively: 1e100 + 1e-100 = 1e100 Because of rounding error. (This is true for some sufficiently large and small exponent.)
- FabHK 8y agoYou don't need to go that far: julia> 1e16 + 1 == 1e16 true julia> 1e19 + 1000 == 1e19 true
- thaumasiotes 8y agoSo what? That's true regardless of whether you add small numbers in before or after the big one. If you have a lot of small numbers that add to 1e-2, and a couple of big numbers that add to 1e+200, it is totally irrelevant what order you add the numbers in, because all of the small numbers together have exactly zero influence on the sum. But we're talking about cases where the sum of the small numbers is large enough to be detectable when measured against the large numbers, even if no individual small number is that large.