[Numpy-discussion] trivial question: how to compare dtype - but ignoring byteorder ?
Travis Oliphant
oliphant.travis at ieee.org
Mon Jul 24 14:36:56 CDT 2006
Sebastian Haase wrote:
> Hi,
> if I have a numpy array 'a'
> and say:
> a.dtype == numpy.float32
>
> Is the result independent of a's byteorder ?
> (That's what I would expect ! Just checking !)
>
I think I misread the question and saw "==" as "="
But, the answer I gave should still help: the byteorder is a property
of the data-type. There is no such thing as "a's" byteorder. Thus,
numpy.float32 (which is actually an array-scalar and not a true
data-type) is interepreted as a machine-byte-order IEEE floating-point
data-type with 32 bits. Thus, the result will depend on whether or not
a.dtype is machine-order or not.
-Travis
More information about the Numpy-discussion
mailing list