Login
Forum Help



Post Your Message
="hidden" name="cat" value="Programming">
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

JamesC
on 2014-10-06
10:52:46
 Re: Basic bug?

A% can be a positive 32768 with no errors. This gives us an integer range of -32767 to 32768.

I would consider this an error in the documentation, not in BASIC. wink

Posted By

SVS
on 2014-10-06
06:14:46
 Re: Basic bug?

Extended info: The bug affects any integer variable or function, when the value is -32768.

Examples:
a%=-32768 ---> Error!
As result: a%=-32000-768 ---> Error!
Even bypassing the direct set of the variable: k=-32568: a%=k: print a% ---> Error!

Posted By

Csabo
on 2014-09-26
11:00:52
 Re: Basic bug?

Good find! I can confirm that indeed -32768 is the only one that produces the error message.

Though my hunch is that it's not an equal versus smaller-than issue. If they wanted to limit it to 16 bit values, the probably would have put in an upper barrier as well. 32767 is the highest one working correctly, above that, you get the same "value truncation" as with negative numbers, and none of the values give the error.

So yeah, it is odd. Not sure of the exact cause, I don't have time to track it down, but with YAPE and/or the ROM disassembly plus patient, you could just step through it.

Posted By

SVS
on 2014-09-26
08:35:32
 Basic bug?

Try PRINT NOT(-32768) and you'll obtain ILLEGAL QUANTITY ERROR and this is correct.
But NOT(-32769) or NOT(-32770) or other lower values do not output any error message.

Probably the O.S. code checking for values lower than -32767 uses "=" instead of "<".


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon