x <- 1:4
y <- 4:1
## calculate sum of x an y directly
xy.s <- x + y
## and after log transformation
xy.ls <- logSum(log(x),log(y))
## errors are small:
err <- xy.ls - log(xy.s)
Run the code above in your browser using DataLab