[SciPy-Dev] cephes_smirnov never returns on mips/sparc/...
Yaroslav Halchenko
lists at onerussian.com
Fri Mar 30 16:37:58 EDT 2012
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
and then it goes into the loop with
(gdb) print nn
$32 = 2147483647
so it might eventually return (didn't wait long enough) but that would
take a while ;)
what confuses ignorant me is why floor on sparc
* why it doesn't handle nan correctly as manpage says:
If x is integral, +0, -0, NaN, or an infinity, x itself is returned.
* why it doesn't return double for double as manpage (looking at x86 box
but that should remain valid I guess) says:
double floor(double x);
float floorf(float x);
long double floorl(long double x);
but returns float :
(gdb) print sizeof(floor ((double) n * (1.0 - e)))
$1 = 4
* and I guess I need to learn about different types of nans
(gdb) print e
$27 = nan(0x8000000000000)
(gdb) print sizeof(e)
$28 = 8
(gdb) print sizeof(NPY_NAN)
$29 = 8
(gdb) print NPY_NAN
$31 = nan(0x100000001)
On Fri, 30 Mar 2012, Yaroslav Halchenko wrote:
> quite positive (may be not straight in cephes_smirnov but nowhere
> near python ;) ) -- I will rebuild ones more -- previously gdb was
> confused with source file was changed during build... hopefully this
> time it would be cleaner -- it takes a bit though on that sparc ;)
> On Fri, 30 Mar 2012, Pauli Virtanen wrote:
> > > With recent scipy (including git master 0fbfdbc)
> > > scipy.stats.ksone.fit
> > > seems to stall (never return) on big-endian boxes and return (1.0, nan,
> > > nan) on x86. It seems that it is working correctly with scipy
> > > 0.7.2 (as it is now in Debian stable).
> > Are you sure it really hangs in cephes_smirnov? I'd run the code with
> > 'python -m pdb xxx.py' and step through the execution to be sure that
> > the problem is not on the Python level.
> > The only change made to cephes_smirnov since 0.7.2 is to make it return
> > a NAN in undefined cases, so it seems unlikely the problem is there. To
> > check if the problem is in cephes_smirnov, set a breakpoint to
> > cephes_smirnov in GDB and follow the execution.
--
=------------------------------------------------------------------=
Keep in touch www.onerussian.com
Yaroslav Halchenko www.ohloh.net/accounts/yarikoptic
More information about the SciPy-Dev
mailing list