[NumPy-Tickets] [NumPy] #1774: assert_array_almost_equal prints low precision

NumPy Trac numpy-tickets@scipy....
Wed Mar 16 11:07:25 CDT 2011

#1774: assert_array_almost_equal prints low precision
 Reporter:  sienkiew       |       Owner:  somebody   
     Type:  enhancement    |      Status:  new        
 Priority:  normal         |   Milestone:  Unscheduled
Component:  numpy.testing  |     Version:  devel      
 Keywords:                 |  
 If you do this,
 a=numpy.array( [  16.50698631688883822 ] )
 b=numpy.array([ 16.50698632 ])

 it says

 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.

Ticket URL: <http://projects.scipy.org/numpy/ticket/1774>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list