[SciPy-user] scipy.special.round [was: Re: scipy.test() runs for >6hrs]

Robert Kern robert.kern at gmail.com
Tue Dec 20 18:25:19 CST 2005

Travis Brady wrote:
> This email prompted me to test my SVN build of scipy (updated yesterday)
> and encountered this:
> ======================================================================
> FAIL: check_round (scipy.special.basic.test_basic.test_round )
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File
> "C:\Python24\lib\site-packages\scipy\special\tests\test_basic.py", line 1
> 793, in check_round
>     assert_array_equal(rnd,rndrl)
>   File "C:\Python24\Lib\site-packages\scipy\test\testing.py", line 738,
> in asser
> t_array_equal
>     assert cond,\
> AssertionError:
> Arrays are not equal (mismatch 25.0%):
>         Array 1: [10 10 10 11]
>         Array 2: [10 10 11 11]

Okay, this is a platform-dependent bug that we've discussed several times
before. scipy.special.round is documented to round numbers which have a
fractional part of exactly 0.5 to the nearest even number. On some platforms
(like OS X and whatever combination of Windows and CPU you have) this works
fine. On other platforms (like some combinations of Linux and Intel CPUs), this
does not work.

I have committed the proper unit test and a comment on why it is the proper
test. If you are actually getting [10 10 11 11] in Array 1, then you have a bug
in Cephes' round function, *not* the unit test.

Robert Kern
robert.kern at gmail.com

"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