I would say you really don't need to worry about either speed or accuracy of summation in "normal" circumstances.
Often the question "Which is the fastest way" can be translated into "The way I doing it now is really slow; how can I improve it."
With List::Util::sum() running 100x faster than the best pure perl equivalent, why wouldn't you use it even if you don't need the speed; and for some of the methods attempted by beginners and even experienced programmers new to Perl -- eg. the recursive solution in the OP -- sum() can be almost 1000 times faster. Perl sucks at recursion.
In reply to Re^2: Best way to sum an array?
by BrowserUk
in thread Best way to sum an array?
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |