Skip to content

BUG: Unexpected result in uint8 division on x86 #19045

@seiko2plus

Description

@seiko2plus

The bug can occur in special cases e.g. when the divisor is scalar and equal to 9 or 13 and the dividend is array contains consecutive duplicate values of 233.

Reproducing code example:

>>> import numpy as np
>>> a = np.full(64, 233, dtype=np.uint8)
>>> a // 9
array([25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25,
       26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26,
       25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25,
       26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26, 25, 26], dtype=uint8)

NumPy/Python version information:

main, after #18075. related to #18178

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions