x = c(1, 1e20, 1e40, -1e40, -1e20, -1)
a = sum(x); print(a)
b = sumexact(x); print(b)
stopifnot(b==0)
a = cumsum(x); print(a)
b = cumsumexact(x); print(b)
stopifnot(b[6]==0)
Run the code above in your browser using DataLab