[SciPy-user] special.round(10.5) [was: Installing SciPy on Mac OS X Tiger]

Robert Kern rkern at ucsd.edu
Tue Jun 14 16:02:43 EDT 2005


Fernando Perez wrote:
> Robert Kern wrote:
> 
>> It's an incorrect test, I believe.
>>
>> Other devs: special.round() has different behavior than scipy.round() 
>> (which is just an alias to Numeric.around()).
>>
>> In [15]:scipy.round(10.5)
>> Out[15]:11.0
>>
>> In [16]:scipy.round(11.5)
>> Out[16]:12.0
>>
>> In [17]:scipy.special.round(10.5)
>> Out[17]:10.0
>>
>> In [18]:scipy.special.round(11.5)
>> Out[18]:12.0
>>
>> I submit that "round-to-nearest-even" is desirable (and in any case 
>> comes part and parcel with using the cephes implementation), and we 
>> should adjust our test case accordingly.
>>
>> Or rather, I already have.
> 
> Have you?  With a fresh CVS checkout, I still get this:
> 
> ======================================================================
> FAIL: check_round (scipy.special.basic.test_basic.test_round)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File 
> "/usr/lib/python2.3/site-packages/scipy/special/tests/test_basic.py", 
> line 1789, in check_round
>     assert_array_equal(rnd,rndrl)
>   File "/usr/lib/python2.3/site-packages/scipy_test/testing.py", line 
> 715, in assert_array_equal
>     assert cond,\
> AssertionError:
> Arrays are not equal (mismatch 25.0%):
>         Array 1: [10 10 11 11]
>         Array 2: [10 10 10 11]

Yes, it's been checked in. However, it appears that on your machine, 
scipy.special.round(10.5) == 11. Bugger. Can you give me the 
repr(scipy.special.round) like this:

In [1]: scipy.special.round
Out[1]: <ufunc 'round'>

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the SciPy-User mailing list