1

I'm trying to compute log(exp(x)-exp(y)); since this is not sum anymore, I can't use LogSumExp and things can still get very ugly if exp(x) or exp(y) is large (e.g.) exp(32) or something).

How do I do this more safely?

ElleryL
  • 507
  • 7
  • 16
  • 2
    Assuming x>y, you can do `log(exp(x)-exp(y))=log(exp(x) * [exp(x)-exp(y)]/exp(x)) = x + log(1-exp(y-x))`, which may be a bit more stable – lisyarus Aug 27 '18 at 18:35

0 Answers0