[SciPy-dev] cephes.tandg test

David M. Cooke cookedm at physics.mcmaster.ca
Wed Jan 11 05:44:56 CST 2006


On Jan 10, 2006, at 09:35 , Arnd Baecker wrote:

> Hi,
>
> all numpy/scipy tests pass on the Itanium2, apart from
> the following error:
>
> ======================================================================
> FAIL: check_tandg (scipy.special.basic.test_basic.test_cephes)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File
> "/home/baecker/python2/scipy_lintst_n_nothing/lib/python2.4/site- 
> packages/scipy/special/tests/test_basic.py",
> line 436, in check_tandg
>     assert_equal(cephes.tandg(45),1.0)
>   File
> "/home/baecker/python2//scipy_lintst_n_nothing/lib/python2.4/site- 
> packages/numpy/testing/utils.py",
> line 81, in assert_equal
>     assert desired == actual, msg
> AssertionError:
> Items are not equal:
> DESIRED: 1.0
> ACTUAL: 1.0000000000000002
> ----------------------------------------------------------------------
>
> The is caused by the strict equality test:
>
>     def check_tandg(self):
>         assert_equal(cephes.tandg(45),1.0)
>
> Is there a reason, why one should get 1.0 up to the last bit?
> If not an `assert_almost_equal` might be more appropriate?

Well, I'd argue that if you've gone to the trouble of making a  
version of tan that takes degrees, it *should* return exact values  
for those that it can (tan(0) = 0, tan(+-45) = +-1).

The cephes code was weird enough that it could miss that, so I added  
a special case test
http://projects.scipy.org/scipy/scipy/changeset/1545

See if it works now.

-- 
|>|\/|<
/------------------------------------------------------------------\
|David M. Cooke              http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca




More information about the Scipy-dev mailing list