08-15-2023, 04:27 PM
(08-15-2023, 02:41 PM)bplus Wrote: @dbox Eeeh! I thought things would get "fixed" automatically because the Kelp array has the _Unsigned Long Type = only positive integers.I'm afraid that only affects the value stored in the array. The reason the Fix() is needed is due to the fact that there are places where floating point values were passed in as the index to the array.
ReDim Shared kelp(sw, sh) As _Unsigned Long
So, here's a simple example to illustrate the point. If you run this in QB64:
Code: (Select All)
Dim numbers(10) As _Unsigned Long
numbers(1.2) = 20
numbers(1.3) = 30
Print numbers(1.2)
Print numbers(1.3)
It will print:
Code: (Select All)
30
30
However, if you run the same example in QBJS it will print:
Code: (Select All)
20
30
(08-15-2023, 02:41 PM)bplus Wrote: wait this FIX was needed???Ha, no, not in this case. I must have just got carried away with calls to Fix()
r = Fix(Int(Rnd * 23) + 1)
why doesn't INT alone fix it? You have to FIX a number already made integer?
(08-15-2023, 02:41 PM)bplus Wrote: Sorry don't mean to be argumentative but I remember things better if they make sense to me.I'm all for spirited discussions and I don't mind critique. That's the kind of feedback I need to make QBJS better.