Feature suggestion: sum() ought to use a compensated summation algorithm

hdante hdante at gmail.com
Sun May 4 11:19:34 EDT 2008


On May 3, 7:05 pm, sturlamolden <sturlamol... at yahoo.no> wrote:
> On May 3, 10:13 pm, hdante <hda... at gmail.com> wrote:
>
> >  I believe that moving this to third party could be better. What about
> > numpy ? Doesn't it already have something similar ?
>
> Yes, Kahan summation makes sence for numpy arrays. But the problem
> with this algorithm is optimizing compilers. The programmer will be

 No, optimizing compilers shouldn't discard floating point operations
by default, since it changes program behavior. If they do, at least
there should be a flag to turn it off.

> forced to use tricks like inline assembly to get around the optimizer.
> If not, the optimizer would remove the desired features of the
> algorithm. But then we have a serious portability problem.




More information about the Python-list mailing list