Suppose I have values of log(P(x_i)), i.e. log-probabilities to events x_i. The probabilities are very small, so that these log-values are of the order of -1e3.
I want to compute an expectation value. In order to evaluate the corresponding sum, I need the probabilities P(x_i) themselves so I tried to call numpy.exp. This however, returns only 0 as the precision of basic floats in Python is not high enough to resolve a number like exp(-1000).
What is the typical way to circumvent this issue?