So, I'm having some precision issues in Python.
I would like to calculate functions like this:
P(x,y) = exp(-x)/(exp(-x) + exp(-y))
Where x and y might be >1000. Python's math.exp(-1000) (in 2.6 at least!) doesn't have enough floating point precision to handle this.
- this form looks like logistic / logit / log-odds, but it's not, right? Is there some algebraic simplification I'm missing here?
- I know about Decimal, but am not sure if it applies here
- looks like homework, but it's not, I promise!
(Also, I'm open to titles! I couldn't think of a good one for this question!)