Skip to content

Multiplying int array by nans results in unexpected behavior #19453

@vikrapivin

Description

@vikrapivin

When you multiply a subset of an int array by np.nan, you get unexpected results.

Reproducing code example:

import numpy as np
test = np.arange(3)
test[0:1] = np.nan*test[0:1]
print(test)

Error message:

No error message, but you see the following output:

[-9223372036854775808 1 2]

I assume this is incorrect behavior, but maybe I am mistaken. If so, sorry for the false report!

NumPy/Python version information:

1.21.0 3.9.6 (default, Jun 29 2021, 00:00:00)
[GCC 11.1.1 20210531 (Red Hat 11.1.1-3)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions