[Numpy-discussion] ones with non-native dtype byteorder

Travis E. Oliphant oliphant@enthought....
Mon Apr 14 15:47:49 CDT 2008


Robert Kern wrote:
> On Mon, Apr 14, 2008 at 1:59 PM, Eric Firing <efiring@hawaii.edu> wrote:
>   
>> This (on little-endian machine) surprised me:
>>
>>  In [23]:np.ones((1,), dtype='<i2')
>>  Out[23]:array([1], dtype=int16)
>>
>>  In [24]:np.ones((1,), dtype='>i2')
>>  Out[24]:array([256], dtype=int16)
>>
>>  I expected the value to be [1] in either case. Am I wrong?
>>     
>
> You are correct. It is a bug in the @NAME@_fillwithscalar() template
> in arraytypes.inc.src; it does not take endianness into consideration.
> I mentioned this to Travis, and he might have time to hop on this, but
> if anyone else can fix it faster, please go for it.
>
>   
Could you check latest SVN.    This should be fixed now.

-Travis O.





More information about the Numpy-discussion mailing list