Computes log(exp(a) + exp(b)) in a numerically stable way,
avoiding overflow and underflow.
Details
Uses the identity: $$\log(\exp(a) + \exp(b)) = \max(a,b) + \log(1 + \exp(-|a-b|))$$
This formulation ensures numerical stability even for extreme values
(e.g., a = 1000 or a = -1000).
Special cases:
If both inputs are
-Inf, returns-Inf.If either input is
Inf, returnsInf.
See also
logsumexp_vec for vector input