[Numpy-discussion] Bug in arange dtype ">f" was: Using arr.dtype.type to check byteorder-independed dtype fails for bool

Sebastian Haase haase at msg.ucsf.edu
Tue Nov 13 08:53:32 EST 2007


On Nov 13, 2007 2:18 PM, Stefan van der Walt <stefan at sun.ac.za> wrote:
> Hi Sebastian
>
> On Tue, Nov 13, 2007 at 01:11:33PM +0100, Sebastian Haase wrote:
> > Hi,
> > I need to check the array dtype in a way that it is ignoring
> > differences coming only from big-endian vs. little-endian.
>
> Does
>
> N.issubdtype(first_dtype, second_dtype)
>
> work?
Hi  Stéfan,

trying to anwer your question with a quick "arange" test, I ran into
more confusion:
>> a = N.arange(.5, dtype=">f")
>>> `a.dtype`
'dtype('float32')'
>>> a = N.arange(.5, dtype="<f")
>>> `a.dtype`
'dtype('float32')'

Both equal positively with N.float32 now !
>>> N.__version__
'1.0.1'

This is (was?) apparently a bug in arange

It works as expected with empty():
>>> N.empty(5, dtype=">f").dtype==N.float32
False
>>> N.empty(5, dtype="<f").dtype==N.float32
True


Cheers,
Sebastian



More information about the NumPy-Discussion mailing list