Learning Scientific Programming with Python (2nd edition)
Q6.1.8: Using np.isclose #2
Question Q6.1.8
Explain why the following evaluates to True
even though the two approximations to $\pi$ differ by more than $10^{-16}$:
In [x]: np.isclose(3.1415926535897932, 3.141592653589793, atol=1.e-16, rtol=0)
Out[x]: np.True_
whereas this statement works as expected:
In [x]: np.isclose(3.14159265358979, 3.1415926535897, atol=1.e-14, rtol=0)
Out[x]: np.False_