On 06/15/2015 09:39 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?=
<schue...@gmx.net>" wrote:
writeln(y.sum); // same as sum(y)
}
An equivalent of the last line:
writeln(reduce!((result, a) => result + a)(y));
`sum` is better for floating-point ranges, because it uses pair-wise or
Kahan summation if possible, in order to preserve precision.
Good point. I had mentioned that elsewhere after learning about it
recently: "the sum of the elements of a range should be calculated by
std.algorithm.sum, which uses special algorithms to achieve more
accurate calculations for floating point types." :)
http://ddili.org/ders/d.en/fibers.html#ix_fibers.recursion
Ali