richard.emery@VSEA.com
Guest
|
Post by richard.emery@VSEA.com on May 7, 2002 21:58:49 GMT
When I type a& = &H00008000 : PRINT a&
MS-DOS QBasic prints -32768 instead of the 65536 that I expected. But other numbers work correctly, such as &HFFFFFFFF, which correctly results in the signed 32-bit integer value of -1. So how do I use the &H facility so that it results in a 32-bit integer number ranging from +32768 to +65536 ?
|
|
qb@guhan.fsnet.co.uk
Guest
|
Post by qb@guhan.fsnet.co.uk on Jun 3, 2002 2:23:08 GMT
First of all &H8000 is = 32768 and not 65536. &H10000 is 65536. I don't know why qbasic treats hex numbers in the range &H0 to &HFFFF as signed integers (even when assigning to long integers). The work around is to implicitly specify it is a long integer by placing an & at the end. e.g.
a&=&H8000& <----!! will give you +32768 a&=&H8000 gives you -32768
Hope this answers your question
|
|