[SciPy-User] int32 overflow and sqrt of -ve number in scipy.stats.wilcoxon
Fri Mar 22 10:57:35 CDT 2013
<josef.pktd <at> gmail.com> writes:
> On Fri, Mar 22, 2013 at 8:43 AM, Simon Baldwin <simonb <at> google.com> wrote:
> > I have run into two distinct but possibly connected failure modes in
> > scipy.stats.wilcoxon. Before bug-reporting, I'd appreciate any
> > thoughts on these.
> this sounds like the same problem that rankdata had and Warren recently fixed.
> My guess is that we can implement wilcoxon using the new rankdata
> (maybe, if we can get the tie counts).
> Otherwise, it would need a change to the c code.
> (old code that wasn't designed for modern computers ?)
Thanks for the note. The offending computation is
corr += 0.5*si*(si*si-1.0)
so I think just converting si from int32 to int64 or float before use would
solve the majority of cases.
> That might be a numerical precision issue in a corner case (-0) that should be
> explicitly handled.
I think it may be a more egregious error than that. In this example the value
being passed to sqrt is -443.05555555555554.
So far I haven't found an easy workround, not least because I don't yet
understand the ties loop in scipy.stats.wilcoxon.
> Please open a ticket.
Will do. Thanks.
Google UK Limited | Registered Office: Belgrave House, 76 Buckingham
Palace Road, London SW1W 9TQ | Registered in England Number: 3977902
More information about the SciPy-User