You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
CONST evaluates
-2 ^ 2
as(-2) ^ 2
and thus gives 4. However, if you actually evaluate this expression in Ex. aPRINT
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 asCONST
should give exactly the same value as evaluating it as a non-CONST
), but it's notable that exponents are not allowed to be inCONST
expressions in QB45 for some reason, so this is not a compatibility issue with QB45.The text was updated successfully, but these errors were encountered: