Prevent underflow in floating point division in Python
问题 Suppose both x and y are very small numbers, but I know that the true value of x / y is reasonable. What is the best way to compute x/y ? In particular, I have been doing np.exp(np.log(x) - np.log(y) instead, but I'm not sure if that would make a difference at all? 回答1: Python uses the floating-point features of the hardware it runs on, according to Python documentation. On most common machines today, that is IEEE-754 arithmetic or something near it. That Python documentation is not explicit