On Saturday, 18 October 2014 at 11:56:15 UTC, Ola Fosheim Grøstad wrote:
On Saturday, 18 October 2014 at 11:43:32 UTC, John Colvin wrote:
           iota(101L).map!((x) => pi * x^^9),
           iota(101L).map!((x) => -pi * x^^9)

Shouldn't the last expression be "-pi * (100-x)^^9" ?

Yeah, my mistake.

auto a = chain(
          iota(1, 101L).map!((x) => pi * x^^9),
          iota(100L, 0L, -1L).map!((x) => -pi * x^^9)
        ).array;
writeln(a.kahanSum);        // 111.157
writeln(a.sum);             // -1272
writeln(a.sort().kahanSum); // 0
writeln(a.sort().sum);      // 760

Reply via email to