[Coco] BASIC09 - unsigned INTEGERs?

L. Curtis Boyle curtisboyle at sasktel.net
Sat Jan 31 20:54:37 EST 2015


Also, you may have to force REAL in the multiplication by specifying a decimal point, ie (using our example):
> c = a * 65536. + b

L. Curtis Boyle
curtisboyle at sasktel.net



> On Jan 31, 2015, at 7:46 PM, Allen Huffman <alsplace at pobox.com> wrote:
> 
> 
>> On Jan 31, 2015, at 11:51 AM, L. Curtis Boyle <curtisboyle at sasktel.net> wrote:
>> 
>> I am pretty sure you can assign regs.x*65536.+regs.u to a FLOAT variable and it works fine… we used to do this at work all the time.
> 
> 
> Nope.
> 
> When it does the math, regs.U is -4601 or whatever on mine, so it does the first part, then subtracts -4601. It was driving me nuts, ‘cause the HEX was printing perfectly (PRINT USING) but the REAL was wrong. I ended up printing each value and that’s when I realized what was going on.
> 
> DIM a:INTEGER
> DIM b:INTEGER
> DIM c:REAL
> 
> a = $0002
> b = $FFFF
> c = a * 65536 + b
> 
> Expected result:
> 
> $0002 * 65536 + $FFFF
> 2 * 65566 + 65535 = 327679
> 
> Actual:
> 
> 2 * 65536 + -1 = 131071
> 
> 		— A
> 
> 
> 
> 
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
> 



More information about the Coco mailing list