[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Integer Basic integers



On Apr 27, 8:55 pm, datajerk <dataj...@gmail.com> wrote:
> Is there a hack, tip, or trick to get Integer Basic to use 0 - 65535
> for the integer range instead of -32768 - 32767.  I would expect 255 *
> 256 to produce a negative number instead of an error.
>
> Thanks.

The largest multiplier that can be entered in integer basic is 256 *
127.  Because of the automatic line checking you cannot even enter a
line like A= B-65536 to give a negative number.  A=32768 also gives an
Overflow Error.  The largest number acceptable is A=32767 or A=-32768.

Depending on what you need the numbers for you could ultimately use 2
variables to get the same result.  Using variable A & B, you get
greater values like this

32766 -   A = 32766 : B=0
32767 -   A = 32767 : B=0
32768 -   A = 0 : B = 1 :      REM   32768 = B * 32768 + A
32769 -   A = 1 : B = 1
.
.
.
65534 -   A = 32766 : B=1
65535 -   A = 32767 : B=1

The variable B ultimately becomes multiples of 32768.

I might be able to figure other ways if you could give a hint as to
how the larger numbers were being used.

Rob