[NumPy-Tickets] [NumPy] #1799: assert_approx_equal against 0.0 always fails

NumPy Trac numpy-tickets@scipy....
Sat Apr 16 03:04:53 CDT 2011


#1799: assert_approx_equal against 0.0 always fails
----------------------------+-----------------------------------------------
  Reporter:  jaety          |       Owner:  somebody   
      Type:  defect         |      Status:  closed     
  Priority:  normal         |   Milestone:  Unscheduled
 Component:  numpy.testing  |     Version:  1.5.1      
Resolution:  invalid        |    Keywords:             
----------------------------+-----------------------------------------------
Changes (by rgommers):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 I think you misunderstand. It does not test for absolute tolerance but for
 significant digits. 0.0 and (not 0.0) will always be different in the
 first significant digit, so the function is supposed to fail.
 {{{
 >>> assert_approx_equal(0.0, 0.0)   # works correctly
 >>> assert_approx_equal(1e-7, 1.000001e-7)
 ...
 AssertionError
 }}}

 Please use {{{assert_allclose}}} for testing absolute or relative
 tolerance.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1799#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list