Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect operator predudece #4

Closed
Roger-luo opened this issue Apr 29, 2021 · 2 comments
Closed

incorrect operator predudece #4

Roger-luo opened this issue Apr 29, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@Roger-luo
Copy link
Member

Roger-luo commented Apr 29, 2021

e.g the following

s = """OPENQASM 2.0;
gate test_gate2(theta, phi) qreg_2, qreg_3, qreg_1 {
  x qreg_1;
  z qreg_2;
  rx(-(sin(theta))+2.0) qreg_3;
  rx(sin(theta)+tan(phi)) qreg_3;
  ry(cos(phi)-ln(phi)) qreg_3;
  ry(cos(phi)*sqrt(phi)) qreg_3;
  CX qreg_1, qreg_3;
}
"""
target_qasm = OpenQASM.parse(s).prog[1]
julia> target_qasm.body[3].cargs[1]|>OpenQASM.print_qasm
-sin(theta)+2.0

the negative sign is outside of sin(theta)+2.0 instead of (-sin(theta)) + 2.0

@thautwarm know how to fix this?

@Roger-luo Roger-luo added the bug Something isn't working label Apr 29, 2021
@HandyKurniawan
Copy link

Hi @Roger-luo,

I don't see any differences between -( sin(theta) )+2.0 and (-sin(theta)) + 2.0. I think that the ( ) will do nothing because there is only a single value inside. For example. (a) + (b) will only become a + b.

But maybe you could elaborate more about the bug?

@Roger-luo
Copy link
Member Author

I don't quite remember what was the issue, maybe I thought the sign was -(... + 2.0) I'm gonna close this first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants