On 10/18/2014 8:17 AM, Andrei Alexandrescu wrote:
On 10/18/14, 4:43 AM, John Colvin wrote:auto kahanSum(R)(R input) { double sum = 0.0; double c = 0.0; foreach(double el; input) { double y = el - c; double t = sum + y; c = (t - sum) - y; sum = t; } return sum; }No need to implement it. http://dlang.org/phobos/std_algorithm.html#.sum
Wow, I hadn't noticed that before. Sweet!