Skip to content

Precedence of power operator #935

@Ionizing

Description

@Ionizing

Hi, consider the short code

print(-2**2)

I would expect it prints -4 while it gives 4, meaning that -2**2 equals (-2) ** 2, which is contradict to the common precedence of negate and power (for example, Python and Fortran would print -4).

Is it an expected behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions