-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
Labels
Description
Describe the issue:
Converting a negative integer with dtype float
, float32
, or float64
to uint32
or uint64
gives zero on MacOS ARM machines.
- Tested on Numpy 1.23 and 1.24.
- Tested on multiple MacOS ARM machines.
- Expected behaviour is to wrap around the maximum unsigned integer, which is what is done on x64 machines
- Wrap around also works when converting to
uint8
andunint16
This exact operation is discussed in the 1.24 release notes, and the provided example does work. However, it fails when the input has dtype float
, and conversion is to 32- or 64-bit unsigned integers.
Reproduce the code example:
import numpy as np
np.array(-1).astype(np.uint32)
>>> array(4294967295, dtype=uint32)
np.array(-1, dtype=float).astype(np.uint32)
>>> array(0, dtype=uint32)
Error message:
No response
Runtime information:
1.23.2
3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 07:07:06) [Clang 13.0.1 ]
-and-
1.24.1
3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:00:33)
[Clang 13.0.1 ]
[{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP', 'ASIMDDP'],
'not_found': ['ASIMDFHM']}}]
Context for the issue:
This breaks correct matrix building for the Brightway life cycle assessment framework.