Skip to content

Small integer powers of real±0j are invalid#117999

@skirpichev

Description

@skirpichev

For example,

>>> z1 =complex(1,+0.0) >>> z1**2 (1+0j) >>> z1*z1 (1+0j) >>> z2 =complex(1,-0.0) >>> z2**2 (1+0j) >>> z2*z2 (1-0j)

"Big enough" or non-integer powers are unaffected:

>>> z2**2000 (1-0j) >>> z2**2.1 (1-0j)

It seems, this is related to


Instead, imaginary component of r should copy the sign from x.imag.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions