Y
Hacker News
new
|
ask
|
show
|
jobs
by
mpyne
27 days ago
C++ has std::reduce for that, which is std::accumulate except it's defined to operate without any specific ordering.
2 comments
rzzzt
27 days ago
Thanks everyone, my C++ knowledge has been greatly expanded today.
link
Joker_vD
27 days ago
And now you should probably also stop and consider whether adding elements one-by-one as opposed to recursively adding together sums of smaller subarrays has better or worse numerical behaviour in regards to e.g. rounding and stability.
link