[Numpy-discussion] BigInteger equivalent in numpy
josef.pktd at gmail.com
josef.pktd at gmail.com
Thu Jun 4 08:55:08 EDT 2009
On Thu, Jun 4, 2009 at 8:19 AM, wierob <wierob83 at googlemail.com> wrote:
> Hi,
>
> is there a BigInteger equivalent in numpy? The largest integer type I
> wound was dtype int64.
>
> I'm using stats.linregress to perform a regression analysis. The return
> stderr was nan because stas.ss(...) returned a negative number due to an
> overflow. Setting dtype to int64 for my input data seems to fix this.
> But what if my data does not fit in int64?
>
> Since Python's long type can hold large data I tried to convert my input
> to long but it gets converted to int64 in numpy.
>
you could try to use floats. stats.ss does the calculation in the same
type as the input.
If you convert your input data to floating point you will not get an
overflow, but floating point precision instead.
Note during the last bugfix, I also changed the implementation of
stats.linregress and now (0.7.1 and later) it doesn't use stats.ss
anymore, instead it uses np.cov which always uses floats.
Also, if you are using an older version there was a mistake in the
stderr calculations, http://projects.scipy.org/scipy/ticket/874
Josef
> kind regards
> robert
More information about the NumPy-Discussion
mailing list