Skip to content

variable negative exponents not detected for float promotion #44

@ylluminate

Description

@ylluminate

Literal negative exponents like 2 ** -1 correctly use math.pow (float), but variables aren't detected:

n = -1
x = 2 ** n  # 0.5 in Python
n := -1
x := math.powi(2, n)  // 0 in V

Detecting this would need data-flow analysis to know n is negative. Not sure it's worth the complexity since most real code uses literal exponents, but documenting it here in case someone hits it.

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