annoying numpy promotion to int64 #117

Open
opened 2021-11-28 12:16:04 +08:00 by sb10q · 0 comments
Owner
>>> x = 3
>>> x |= int32(8)
>>> type(x)
<class 'numpy.int64'>

Workaround:

>>> x = int32(3)
>>> x |= int32(8)
>>> type(x)
<class 'numpy.int32'>

There's probably nothing we can do about it, except document this pitfall which can cause surprising problems when writing @portable functions.

``` >>> x = 3 >>> x |= int32(8) >>> type(x) <class 'numpy.int64'> ``` Workaround: ``` >>> x = int32(3) >>> x |= int32(8) >>> type(x) <class 'numpy.int32'> ``` There's probably nothing we can do about it, except document this pitfall which can cause surprising problems when writing ``@portable`` functions.
sb10q added the
low-priority
label 2021-11-28 12:16:04 +08:00
sb10q added this to the Beta milestone 2022-04-12 11:05:41 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#117
No description provided.