[SciPy-dev] bug in scipy.stats.norm.cdf ?
John Hunter
jdh2358 at gmail.com
Sun Mar 4 18:36:55 EST 2007
On 3/4/07, eric jones <eric at enthought.com> wrote:
> It looks like it works with latest install of Python -- Enthought
> Edition on WinXP. This is python 2.4.3.
>
> In [81]: from scipy.special import _cephes as c
>
Yep, it's an isnan bug. If I add a dummy function "erfjdh" to ndtr.c
and _cephesmodule.c
double erfjdh(double x)
{
double y, z;
if (isnan(x)) {
mtherr("erf", DOMAIN);
return -2.0;
}
return 2.0;
}
and then run my test code
In [1]: import scipy
In [2]: import scipy.special._cephes as c
In [3]: x = scipy.arange(-3, -2, 0.1)
In [4]: c.erfjdh(x)
Out[4]: array([ 2., 2., 2., 2., 2., -2., 2., 2., 2., 2.])
But apparently the internal isnan testing in ndtr.c is different than
the toplevel testing because
In [5]: scipy.isnan(x)
Out[5]: array([False, False, False, False, False, False, False, False,
False, False], dtype=bool)
Still digging...
More information about the SciPy-Dev
mailing list