# Calculate proportions of exponentially weighted factors avoiding underflow problem

I am trying to implement in Python this ratio: $\frac{w_t(i)}{\sum w_t(j)}$ where $w_t(i) = w_{t-1}(i)\cdot\exp{(-x_{t}(i))}$, i.e. the weights are exponentially decreasing without running into underflow problems. I am using this ratio in a formula later. Has anyone had the same problem? Any ideas? I read a bit about the logsumexp trick but I am not sure I can use it here.