Try this in QBasic: A& = &H80 B& = &H8000 C& = &H800000 D& = &H80000000 PRINT A& PRINT B& PRINT C& PRINT D& END The output: 128 -32768 8388608 -2147483648 Makes it pretty tough to use 32-bit quantities...
Yes, they are supposed to be long (32-bit) ints. So why does &H8000 have a sign?
They are 32-bits -- one of which is for the sign. I don't know QBasic, but it appears to not support unsigned 32bit -- at least not with the notation above. :) The integer range is H80000000 to 0 to H7FFFFFFF. So, you do have 32bits to work with, but you'll have to offset all your numbers by H80000000 to use all those bits if you don't have negitive numbers. :)
I know how negative numbers are represented: the high bit is set. Therefore &H8000, if it is 32 bits, should be positive.
Solved it, if you can call it a solution. This doesn't work: DIM A AS LONG A& = &H8000 PRINT A& for you just get -32768 as before. However: A& = &H8000& 'Need to include the trailing "&" PRINT A& gives +32767.
Ah, yes, conversion rules. &H8000 is a 16-bit number. When you assign 16-bit to 32-bit, the value gets sign-extended. The problem is that none of MS's Basics support any notion of unsigned-ness.