[SciPy-Dev] scipy.special test failures for 0.8.0b1

Pauli Virtanen pav@iki...
Thu Jun 17 11:37:47 CDT 2010

Thu, 17 Jun 2010 22:05:43 +0800, Ralf Gommers wrote:
> These scipy.special test failures were reported by Derek Homeier for
> 0.8.0b1. Are these all just cases of the test precision being a little
> too high, or is there an actual problem? What should be done with them
> for the 0.8.0 release?

I can try to take a closer look today evening.

> FAIL: test_iv_cephes_vs_amos (test_basic.TestBessel)
> Not equal to tolerance rtol=1e-12, atol=1e-305 (-120,
> 700.60000000000002) (mismatch 100.0%)
>  x: array(9.7596849076267918e+297)
>  y: array((9.7596849444884899e+297+0j))

The AMOS result 9.7596849444884899e+297 is correct.

For some reason, on that platform the Boost code computes gives a result 
that is off by 4e-9. Not disastrous, so the test tolerance could simply 
be bumped to 5e-9.

> while the following also fails on darwin-i386:
> FAIL: test_iv_cephes_vs_amos_mass_test (test_basic.TestBessel)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File
>  "/sw/lib/python2.6/site-packages/scipy/special/tests/test_basic.py",
> line 1712, in test_iv_cephes_vs_amos_mass_test
>    assert dc[k] < 1e-9, (iv(v[k], x[k]), iv(v[k], x[k]+0j))
> AssertionError: (1.8320048963545875e+306, (inf+0j))

The test is probably buggy -- it probably shouldn't assume that much 
about when AMOS decides a result is inf. That also seems to be platform-

> FAIL: test_data.test_boost(<Data for gamma:
> test_gamma_data_ipp-near_m55>,)
> Max |adiff|: 5.56451e-80
> Max |rdiff|: 6.01399e-12

The tolerance is just too strict. rtol should probably be around 1e-11

> FAIL: test_data.test_boost(<Data for gammaincinv:
> gamma_inv_big_data_ipp-gamma_inv_big_data>,)
> Max |adiff|: 39782.8
> Max |rdiff|: 1
> Bad results for the following points (in output 0):
>                   40010.84375             0.12698681652545929
> =>                            0.0 !=             39782.764004009827
> (rdiff
>                            1.0)

I get this also on x86,

>>> scipy.special.gammaincinv(40010.84375, 0.12698681652545929)
__main__:1: SpecialFunctionWarning: gammaincinv: failed to converge at 
(a, y) = (40010.84375, 0.12698681652545928955): 3

My bad -- the function tries to be too strict about tolerance. There are 
two bugs here: ~eps tolerance is probably too much asked, and certainly 0 
is not the correct value to return if tolerances cannot be satisfied...

The function should be fixed.

Pauli Virtanen

More information about the SciPy-Dev mailing list