Exponential of large negative numbers
问题 How does one compute a number such as np.exp(-28000) on Python? The answer is around 5E-12161. I've been told that due to the double-precision floating point format, I would only be able to calculate a number > 1e-2048 回答1: Try the decimal module. Decimal(math.exp(1))**-28000 回答2: Try mpmath for floating-point arithmetic with arbitrary precision Edit 1: >>> import mpmath as mp >>> import numpy as np >>> a = np.matrix((0,0)) >>> print(a) [0.0 0.0] >>> b = mp.matrix(a.tolist()) >>> c = b.apply