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

Robert Kern rkern at ucsd.edu
Wed Jun 8 17:59:54 CDT 2005


Zhiwen Chong wrote:

> I took your advice and checked out a CVS copy and downloaded hpc's  g77 
> again just now. It builds okay now!

/me does the Happy Build Dance.

> When I ran scipy.test(), it reported "no test file found" for many of  
> the modules,

Those are normal. They are reminders to us developers to actually write 
those tests.

> but as far as actual failures go, there was only one  (out 
> of 1174):
> 
>     FAIL: check_round (scipy.special.basic.test_basic.test_round)
>      ----------------------------------------------------------------------
>     Traceback (most recent call last):
>       File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
> python2.4/site-packages/scipy/special/tests/test_basic.py", line  1789, 
> in check_round
>         assert_array_equal(rnd,rndrl)
>       File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
> python2.4/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 10 11]
>             Array 2: [10 10 11 11]
> 
> I take it that's normal on OS X?

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.

-- 
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