Confirmed. It might be a glitch which can be easily fixed by QB64 Team.
Thanks for confirming.
I disagree slightly with your last remark. If you assign the result to a LONG variable (signed) and print that variable, you get the correct result (at least, I did). Nevertheless, it is a bug, and a remarkable find of yours.
Hmm...
In my actual code where I discovered the bug, I had a data type containing _UNSIGNED LONG variables. I was then doing a math expression with those variables with the result stored in a signed variable (I think a _FLOAT or _INTEGER64, maybe another type) and it was forcing the answer to be unsigned. In this case I was doing -Variable and then -1 * Variable with broken results. I then tried forcing the type with INT(), no help. Then I tried putting parenthesis around the unsigned variable to remove its type, but it didn't help. The entire math expression was always forced to be unsigned.
I ended up changing my 20 or so _UNSIGNED LONG variables/data types to all be LONG to work around the bug. At first I thought the behaviour might have been intentional, but it seems to only affect _UNSIGNED LONG type.
I'll do some more poking around later to see how I got the wrong answer when storing the result into a signed variable, because I know that can happen, as that's how I discovered it.
I found if you change -1 to -1.0 it behaves
baz~& = 10
PRINT (baz~& + 10) * -1.0
I don't know if that's helpful
That's very peculiar, and definitely useful information. Integer vs. floating point affecting the result being signed or unsigned seems strange. Probably there are multiple issues with how QB64 is interpretting math expressions containing mixed types.
From a "makes sense" perspective, all math expressions should be calculated with maximum precision, then the result forced to conform with any requested data type.
(unsigned types being multiplied by negative numbers, seems this jumps types, can be a problem sometimes)
That was why I put the unsigned variable in parenthesis and with integer math (var + 10), but it makes no difference for this bug. The expression must do parenthesis first, so by the time it gets to the * -1 it should already be a non-variable "20", but it remains an unsigned 20 somehow.
Edit:
I just thought about it more, and I think the reason using 1.0 instead of 1 works around the bug is because 1.0 is forcing it to evaluate as a float, and floats can't be unsigned. That said, using INT() should also force it to be signed, but it keeps it as unsigned. More hmm...