Skip to content

np.floor_divide drops imaginary part silently #13236

@FranzForstmayr

Description

@FranzForstmayr

Reproducing code example:

import numpy as np
a = np.arange(10) + 1j* np.arange(10)
a
# array([0.+0.j, 1.+1.j, 2.+2.j, 3.+3.j, 4.+4.j, 5.+5.j, 6.+6.j, 7.+7.j,
#           8.+8.j, 9.+9.j])
a / 2
# array([0. +0.j , 0.5+0.5j, 1. +1.j , 1.5+1.5j, 2. +2.j , 2.5+2.5j,
#          3. +3.j , 3.5+3.5j, 4. +4.j , 4.5+4.5j])
a // 2
# array([0.+0.j, 0.+0.j, 1.+0.j, 1.+0.j, 2.+0.j, 2.+0.j, 3.+0.j, 3.+0.j,
#          4.+0.j, 4.+0.j])

Is there a special reason for this behavior? I would expect to floor_divide the imaginary and complex part.

Error message:

No error or warning is thrown, not even that imaginary part is getting lost.

Numpy/Python version information:

1.16.1
3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions