[Coco] BASIC09 - unsigned INTEGERs?
Allen Huffman
alsplace at pobox.com
Sat Jan 31 21:45:47 EST 2015
> On Jan 31, 2015, at 8:42 PM, Robert Gault <robert.gault at att.net> wrote:
>
> You don't need to go quite that far to just print the result. If you want to do 32-bit math you might need to separate the four bytes.
> As suggested by others, conversion of the hex words to reals might get around the negative integers.
Yes, I’d love to see someone who can figure this out. I tried all of that with no luck. Even did things like this:
cReal = LAND($FFFF, aInteger)
The problem is, to BASIC09, ANYTHING that is in an INTEGER with the high bit set, is a negative number when it comes to math. I even tried to convert them to strings and back, but no luck. $FFFF converted is still negative.
Right now, the only two working proposals are:
1. check if it’s negative, then add when assigning it to real (simplest).
2. use PEEK to get the individual bytes and build it back
— A
More information about the Coco
mailing list