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)$

  • $\begingroup$ 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)$. $\endgroup$ – Irvan Oct 10 '14 at 16:02
  • 1
    $\begingroup$ Since $b>a$, a better approximation would be $\log b+\log(1+a/b)\approx\log b+(a/b)=\beta+\exp(\alpha-\beta)$. $\endgroup$ – Rahul Oct 10 '14 at 16:30
  • $\begingroup$ @Rahul Wait, is $\log(1+\frac ab) \simeq \frac a b$?! That sounds... very strange. $\endgroup$ – badp Oct 10 '14 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.