[issue19086] Make fsum usable incrementally.

2013-09-30 Thread Oscar Benjamin
Oscar Benjamin added the comment: I should be clearer about my intentions. I'm hoping to create an efficient and accurate sum() function for the new stdlib statistics module: http://bugs.python.org/issue18606 http://www.python.org/dev/peps/pep-0450/ The sum() function currently proposed can be

[issue19086] Make fsum usable incrementally.

2013-09-30 Thread Tim Peters
Tim Peters added the comment: The possible use cases are so varied fuzzy it seems better to use an object for this, rather than funk-ify `fsum`. Say, class Summer. Then methods could be invented as needed, with whatever state is required belonging to Summer objects rather than passed

[issue19086] Make fsum usable incrementally.

2013-09-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: Let's close this one. As Uncle Timmy says, it would be a mistake to funkify the signature for math.fsum. If something like a Summer() class is born, it should start it life outside the standard library, gain a following, and let both the API and

[issue19086] Make fsum usable incrementally.

2013-09-30 Thread Oscar Benjamin
Oscar Benjamin added the comment: Fair enough. Thanks again for taking the time to look at this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19086 ___

[issue19086] Make fsum usable incrementally.

2013-09-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Conceptually, I support the idea of having some way to avoid information loss by returning uncollapsed partial sums. As you say, it would provide an essential primitive for parallel fsums and for cumulative subtotals. If something along those lines were

[issue19086] Make fsum usable incrementally.

2013-09-28 Thread Oscar Benjamin
Oscar Benjamin added the comment: Thanks for responding Raymond. Raymond Hettinger wrote: A start argument won't help you, because you will discard information on input. A sequence like [1E100, 0.1, -1E100, 0.1] wouldn't work when split into subtotal=fsum([1E100, 0.1]) and fsum([-1E100, 0.1],

[issue19086] Make fsum usable incrementally.

2013-09-27 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger priority: normal - low ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19086 ___

[issue19086] Make fsum usable incrementally.

2013-09-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, the reason for __builtin__.sum() having a start argument was so that it could change the base datatype: sum(iterable, start=Fraction(0)). [Oscar Benjamin] Although fsum is internally very accurate it always discards information on output. A

[issue19086] Make fsum usable incrementally.

2013-09-25 Thread Oscar Benjamin
New submission from Oscar Benjamin: I would like to be able use fsum incrementally however it is not currently possible. With sum() you can do: subtotal = sum(nums) subtotal = sum(othernums, subtotal) This wouldn't work for fsum() because the returned float is not the same as the state