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

CONST applies negation higher than exponentiation #196

Closed
mkilgore opened this issue Sep 26, 2022 · 0 comments · Fixed by #435
Closed

CONST applies negation higher than exponentiation #196

mkilgore opened this issue Sep 26, 2022 · 0 comments · Fixed by #435
Labels
bug Something isn't working const-issues

Comments

@mkilgore
Copy link
Contributor

CONST evaluates -2 ^ 2 as (-2) ^ 2 and thus gives 4. However, if you actually evaluate this expression in Ex. a PRINT statement you'll find it evaluates to -4 because QB64's order of operations treat that as -(2 ^ 2), exponentiation is higher then negation.

I'm considering this a bug since CONST should have the same operator order as regular QB64 (IE. Any expression evaluated as CONST should give exactly the same value as evaluating it as a non-CONST), but it's notable that exponents are not allowed to be in CONST expressions in QB45 for some reason, so this is not a compatibility issue with QB45.

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

Successfully merging a pull request may close this issue.

1 participant