Thomas Lumley wrote:

>> So it looks as though sum(c(...)) is somwhow independent of
>> the order of its arguments, which implies that the summation
>> it does is not quite the addition corresponding to "+".
>>
>> I now feel out of my depth, so hope someone else knows/can
>> find the truth about this!
> 
> sum() uses a long double accumulator.

BTW, summing numbers is (surprisingly?) actually a quite interesting problem.
See, for example, the paper ‘A Comparison Of Methods For Accurate Summation’
by John Michael McNamee for some nice example. The paper is available online at
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.103.344&rep=rep1&type=pdf

-- 
Karl Ove Hufthammer

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to