I have two small positive real numbers $u, w$ such that $u > w$. Given $\log(u), \log(w)$ I'd like to find a numerically stable way to calculate $\log(u - w)$.
One possible way of transforming the preceding is : $\log (u - w) = \log(u) + \log(1 - \frac{u}{w})$. There are stable methods which calculate $\log(1 - p)$ for small $p,$ and subsequently log-sum-exp trick may be employed. The problem is $\log(\frac{u}{w})$ may be of order of -10000 hence I don't think straightforward exponentiation is an option here. Any suggestions greatly welcomed.