[SciPy-Dev] cephes_smirnov never returns on mips/sparc/...
Yaroslav Halchenko
lists at onerussian.com
Fri Mar 30 20:45:38 EDT 2012
well -- imho it should have not even got to that point if e is
NaN. Just started rebuilding with following patch:
- if (n <= 0 || e < 0.0 || e > 1.0)
+ # This comparison should assure returning NaN whenever
+ # e is NaN itself. In original || form it would proceed
+ if !(n > 0 && e >= 0.0 && e <= 1.0)
return (NPY_NAN);
On eri, 30 Mar 2012, Pnuli Virtanen wrote:
> Hi,
> 30.03.2012 22:37, Yaroslav Halchenko kirjoitti:
> > ok -- here is the reason:
> > (gdb) print e
> > $27 = nan(0x8000000000000)
> > (gdb) print ((double) n * (1.0 - e))
> > $26 = nan(0x100000001)
> > (gdb) print (floor ((double) n * (1.0 - e)))
> > $25 = 2146435073
> Thanks a lot:
> kolmogorov.c:41
> nn = (int) (floor ((double) n * (1.0 - e)));
> This is just wrong -- if `e` happens to be NAN, the result of the
> integer cast is unspecified (as per C99 standard).
> Probably there should be a blanket input finiteness check in most of the
> routines. I'd be willing to bet that this is not the only bug of this
> type in there. Detecting these automatically would require some control
> flow analysis, so I guess the only option is to go through each function
> manually :/
> Pauli
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
--
=------------------------------------------------------------------=
Keep in touch www.onerussian.com
Yaroslav Halchenko www.ohloh.net/accounts/yarikoptic
More information about the SciPy-Dev
mailing list