I am trying to calculate the exponential of -1200 in python (it’s an example, I don’t need -1200 in particular but a collection of numbers that are around -1200).
>>> math.exp(-1200)
0.0
It is giving me an underflow; How may I go around this problem?
Thanks for any help 🙂
In the standard library, you can look at the
decimalmodule:If you need more functions than
decimalsupports, you could look at the librarympmath, which I use and like a lot:but if possible, you should see if you can recast your equations to work entirely in the log space.