Additional Math functions

Alexander Jones alex at
Fri Oct 2 23:37:47 UTC 2015

Interesting. I still feel that these algorithms should be given their
proper names in a math library, because I would feel quite troubled if
`Math.sum(a, b, c) !== a + b + c`. Maybe I'm alone in this view, though.
What do other languages do?

On Friday, 2 October 2015, Waldemar Horwat <waldemar at> wrote:

> On 10/02/2015 13:30, Alexander Jones wrote:
>> I really don't think I'd want a basic `Math.sum(a, b, c)` meaning
>> anything other than `a + b + c`, i.e. `(a + b) + c`. We should all just
>> come to terms with the fact that floating point addition is not associative.
>> Or is there really some simple, O(n) algorithm to do a better (more
>> "careful") job?
> Kahan summation is simple and O(n).
> There exist efficient algorithms to get the exact sum as well.  See, for
> example,
>     Waldemar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list