JuliaPy / JuliaPy/SymPy.jl

Incorrect precedence of `//` in exponent when converting SymPy expression to Julia `Expr`

Open
#474 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
282
Forks
59
PR merge metrics
No merged PRs in 30d

Description

When converting a SymPy symbolic expression to a Julia `Expr`, if there is an integer-division in an exponent, the integer division is placed into the output `Expr` without parentheses to indicate precedence, which is incorrect.

To reproduce:
```Julia
julia> convert(Expr, 1/(2*x*sympy.pi^(1//4)))
:((1 / 2) * pi ^ -1//4 * x ^ -1)
```

Expected result:
```Julia
:((1 / 2) * pi ^ (-1//4) * x ^ -1)
```

As is, the returned `Expr` is interpreted as `:(((1 / 2) * pi ^ -1)//4 * x ^ -1)`, which is incorrect.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.