If you do this,
a=numpy.array( [ 16.50698631688883822 ] )
b=numpy.array([ 16.50698632 ])
numpy.testing.assert_array_almost_equal(a,b,decimal=15)
it says
AssertionError:
Arrays are not almost equal to 15 decimals
(mismatch 100.0%)
x: array([ 16.50698632])
y: array([ 16.50698632])
In discussion on the mailing list, Robert Kern gave a good explanation of why this happens and suggested that instead of repr(),
It should probably use np.array_repr(x, precision=16)
Instead of fixing the precision at 16, maybe it should use the decimal parameter to choose the precision to print. The point being that if the arrays are not almost equal, we should be able to see which elements did and did not match.
Original ticket http://projects.scipy.org/numpy/ticket/1774 Reported 2011-03-16 by atmention:stsci-sienkiew, assigned to unknown.
If you do this, a=numpy.array( [ 16.50698631688883822 ] ) b=numpy.array([ 16.50698632 ]) numpy.testing.assert_array_almost_equal(a,b,decimal=15)
it says
In discussion on the mailing list, Robert Kern gave a good explanation of why this happens and suggested that instead of repr(), It should probably use np.array_repr(x, precision=16)
Instead of fixing the precision at 16, maybe it should use the decimal parameter to choose the precision to print. The point being that if the arrays are not almost equal, we should be able to see which elements did and did not match.