8000 nonzero() requires swap for float types (Trac #1662) · Issue #2258 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
nonzero() requires swap for float types (Trac #1662) #2258
Closed
@numpy-gitbot

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/1662 on 2010-11-05 by @mwiebe, assigned to unknown.

The current floating-point nonzero() implementation is incorrect for non-native byte order. Swapping the order should have no effect, but it can change the result as visible here:

>>> import numpy as np
>>> a = np.array([0x80000000, 0x00000080, 0], dtype=np.uint32)
>>> a.dtype = np.float32
>>> print a.nonzero()
(array([1]),)
>>> print a.byteswap().newbyteorder().nonzero()
(array([0]),)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0