[Numpy-discussion] What is a numpy.long type?
Charles R Harris
charlesr.harris@gmail....
Fri Aug 23 10:15:08 CDT 2013
On Fri, Aug 23, 2013 at 8:59 AM, Chris Barker - NOAA Federal <
chris.barker@noaa.gov> wrote:
> On Aug 22, 2013, at 11:57 PM, David Cournapeau <cournape@gmail.com> wrote:
>
> npy_long is indeed just an alias to C long,
>
>
> Which means it's likely broken on 32 bit platforms and 64 bit MSVC.
>
> np.long is an alias to python's long:
>
> But python's long is an unlimited type--it can't be mapped to a c type at
> all.
>
> arch -32 python -c "import numpy as np; print np.dtype(np.int); print
> np.dtype(np.long)"
> int32
> int64
>
>
> So this is giving us a 64 bit int--not a bad compromise, but not a python
> long--I've got to wonder why the alias is there at all.
>
> arch -64 python -c "import numpy as np; print np.dtype(np.int); print
> np.dtype(np.long)"
> int64
> int64
>
> Same thing on 64 bit.
>
> So while np.long is an alias to python long--it apparently is translated
> internally as 64 bit -- everywhere?
>
> So apparently there is no way to get a "platform long". ( or, for that
> matter, a platform anything else, it's just that there is more consistancy
> among common platforms for the others)
>
>
I use 'bBhHiIlLqQ' for the C types. Long varies between 32 & 64 bit,
depending on the platform and 64 bit convention chosen. The C int is always
32 bits as far as I know.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130823/86d059ac/attachment.html
More information about the NumPy-Discussion
mailing list