[Numpy-discussion] 64-bit Fedora 9 a=numpy.zeros(0x80000000, dtype='b1')

Citi, Luca lciti at essex.ac.uk
Sat Sep 12 09:19:34 EDT 2009


Hi,

with the standard ubuntu version (1.2.1), I get 

>>> a=np.zeros(0x800000,dtype='b1') # OK

>>> a=np.zeros(0x80000000,dtype='b1')
TypeError: data type not understood

>>> a=np.zeros(0x80000000,dtype=bool)
ValueError: negative dimensions are not allowed

while with 1.4.0.dev7375, I get
>>> a=np.zeros(0x80000000,dtype='b1') # (both 'b1'and bool give the same result)
ValueError: Maximum allowed dimension exceeded

I think it might have something to do with the fact that in a 32bit machine
(like mine, what about yours?) the default int is 32bit.
An int32 with value 0x80000000 has the sign bit set and is actually -2**31.

In fact with a different machine (64bit ubuntu, numpy 1.2.1), it works
>>> a=np.zeros(0x80000000,dtype='b1') # OK

In any case, with a 32bit machine you could not address such a big array anyway.

Best,
Luca



More information about the NumPy-Discussion mailing list