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]: True
whereas this statement works as expected:
In [x]: np.isclose(3.14159265358979, 3.1415926535897, atol=1.e-14, rtol=0)
Out[x]: False
The different behaviour here is due to the finite precision with which real numbers are stored: double-precision floating point numbers are only represented to the equivalent of about 15 decimal places and so the two numbers being compared here are the same to within this precision:
In [x]: 3.1415926535897932 - 3.141592653589793
Out[x]: 0.0