sum.exact(..., na.rm = FALSE)
cumsum.exact(x)
runsum.exact(x,k)
sum.exact
returns single number. Function cumsum.exact
returns vector of the same length as x
. Function runsum.exact
returns vector of length length(x)-k
and attribute "count" containing
number of finite (as in is.finite
) elements in each window.x = c(1, 1e20, 1e40, -1e40, -1e20, -1)
a = sum(x); print(a)
b = sum.exact(x); print(b)
stopifnot(b==0)
a = cumsum(x); print(a)
b = cumsum.exact(x); print(b)
stopifnot(b[6]==0)
Run the code above in your browser using DataLab