# Sum of Logarithm Arguments

This is a very simple question I suspect but I just cannot seem to nail it...

I have values for $X,Y,Z$, where $X =\log (x)$, $Y = \log (y)$ and $Z = \log (z)$ and I need to calculate $x + y + z$, well actually $\log(x + y + z)$ would suffice. Is there a clever way of doing this other than simply doing $e^X+e^Y+e^Z$?

Its for an algorithm where I am trying to avoid underrun - $x=e^X,y=e^Y,z=e^Z$ likely to be very small.

Any pointers much appreciated.

With answer given by @response I ended up using $\log(x+y+z)=\log(e^R+e^S+e^T)-C$ where $R=X+C$, $S=Y+C$, $T=Z+C$

Suppose, we add a constant $C$ to each one of the values: $X, Y, Z$ which would prevent underflow when they are raised to $e$. Then we get:

$X' = X + C$

$Y' = Y + C$

$Z' = Z + C$

Thus, we have:

$x' = e^{X'}$

$y' = e^{Y'}$

$z' = e^{Z'}$

$x'+y'+z' = e^{X'} + e^{Y'} + e^{Z'}$
$e^{X'} + e^{Y'} + e^{Z'} = e^{X+C} + e^{Y+C} + e^{Z+C} = e^C (e^{X} + e^{Y} + e^{Z})$
$x+y+z = (x'+y'+z') e^{-C}$