Skip to content
Prev 42036 / 63435 Next

bug in sum() on integer vector

FYI, the new int64 package on CRAN gets this right, but is of course
somewhat slower since it is not doing hardware 64-bit arithmetic.

?x <- c(rep(1800000003L, 10000000), -rep(1200000002L, 15000000))
 library(int64)
 sum(as.int64(x))
# [1] 0

             - Murray

2011/12/9 Herv? Pag?s <hpages at fhcrc.org>: