Stavros Macrakis wrote

[...]

programming languages (including R).  I don't know whether R's sum function
uses this technique or some other (e.g. Kahan summation), but it does manage
to give higher precision than summation with individual arithmetic
operators:

    sum(c(2^63,1,-2^63)) => 1

not if the arguments are passed as separate elements in ...:

x = c(2^63, 1, -2^63)
sum(x)
# 1
do.call(sum, as.list(x))
# 0

y = 1:3
sum(y)
# 6
do.call(sum, as.list(y))
# 6

vQ

______________________________________________
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