[Numpy-discussion] np.longlong casts to int

Jonathan T. Niehof jniehof at lanl.gov
Wed Feb 22 17:49:33 EST 2012


On 02/22/2012 03:47 PM, Matthew Brett wrote:
> Hi,
>
> I was gaily using np.longlong for casting to the highest available
> float type when I noticed this:
>
> In [4]: np.array([2.1], dtype=np.longlong)
> Out[4]: array([2], dtype=int64)
>
> whereas:
>
> In [5]: np.array([2.1], dtype=np.float128)
> Out[5]: array([ 2.1], dtype=float128)
>
> This on OSX snow leopard numpies 1.2 .1 ->  current devel and OSX tiger
> PPC recent devel.
>
> I had the impression that np.float128 and np.longlong would be
> identical in behavior - but I guess not?

A C long (and longlong) is an integer type. Were you expecting int128?

-- 
Jonathan Niehof
ISR-3 Space Data Systems
Los Alamos National Laboratory
MS-D466
Los Alamos, NM 87545

Phone: 505-667-9595
email: jniehof at lanl.gov

Correspondence /
Technical data or Software Publicly Available



More information about the NumPy-Discussion mailing list