# Stable computation of $\log\sum x_i$ from $\log x_i$, with many terms

Kahan's summation algorithm is a method to compute sums:

$$\sum x_i$$

with many terms, without significant error.

I want to do this with very large numbers, and instead of the numbers themselves, I am given their logarithms, $\log x_i$ ($x_i > 0$), and instead of the sum, I want to compute the logarithm of the sum,

$$\log \sum x_i$$

Is there a variation of Kahan's summation for this case?

• Check out this related post. Also worth looking up logsumexp. – GoHokies Aug 4 '16 at 17:37
• @GoHokies I think the logexpsum trick doesn't work well if you have a single very large term and many very small terms. – becko Aug 4 '16 at 19:22
• scicomp.stackexchange.com/q/24624/988 – becko Aug 4 '16 at 19:39