# How can I approximate the logarithm of the sum?

Consider $\alpha = \log a$ and $\beta = \log b$, $b>a$. Are there formulas for approximating $\gamma = \log (a+b)$? What about $\theta = \log (a-b)$?

If it makes it easier, assume that $|\alpha| \gg 300$ so the obvious solution $\gamma = \log (10^\alpha + 10^\beta)$ is infeasible using standard double-precision floating point arithmetic (you can't easily store $a$ and $b$ in memory to begin with!).

you can try this here $\gamma=\log\left[a\left(1+\frac{b}{a}\right)\right]$= $\log(a)+\log\left(1+\frac{b}{a}\right)$
• which, if $\beta$ is much larger than $\alpha$, then $\log(1 + \frac{b}{a})$ is approximately $\log(\frac{b}{a}) = \log(b) - log(a)$ and the entire thing degrades to approximately $log(b)$. – Irvan Oct 10 '14 at 16:02
• Since $b>a$, a better approximation would be $\log b+\log(1+a/b)\approx\log b+(a/b)=\beta+\exp(\alpha-\beta)$. – Rahul Oct 10 '14 at 16:30
• @Rahul Wait, is $\log(1+\frac ab) \simeq \frac a b$?! That sounds... very strange. – badp Oct 10 '14 at 17:22