D-Programming-Language/phobos — pull request #1966 by monarchdodra (2014-02-25 20:37:07+00:00)
Title: Fix issue 12169 - sum(int[]) should return a int

Doing it this way is closer to what `reduce` does (barring issue 10709: reduce 1-function + no seed, wrong type inference https://d.puremagic.com/issues/show_bug.cgi?id=10709). It should help prevent surpises for anyone migrating from `reduce` to `sum`.

Once this is merged, I plan to upgrade the design to accept a seed.
* No seed => current design
* Seed => Do implementation on seed type.

This will give users a better ability to control how they want to sum: For intance, sum ints into longs, or sum longs into a double without overflowing. Yet still keep `sum`'s higher accuracy algorithms.