The direct way is to perform two exponentiations:
ln(x+y) = ln(eln(x) + eln(y))
The log_add
function uses a slightly different approach to get the same result with only one:
ln(x+y) = ln((x+y)x/x)
= ln((x+y)/x) + ln(x)
= ln(1 + y/x) + ln(x)
= ln(1 + eln(y/x)) + ln(x)
= ln(1 + eln(y)-ln(x)) + ln(x)