QBJS Swimming fish with Kelp
#8
(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.

ReDim Shared kelp(sw, sh) As _Unsigned Long
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.

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???
r = Fix(Int(Rnd * 23) + 1)
why doesn't INT alone fix it?  You have to FIX a number already made integer?
Ha, no, not in this case.  I must have just got carried away with calls to Fix()


(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.
Reply


Messages In This Thread
QBJS Swimming fish with Kelp - by bplus - 08-15-2023, 02:37 AM
RE: QBJS Swimming fish with Kelp - by dbox - 08-15-2023, 12:06 PM
RE: QBJS Swimming fish with Kelp - by bplus - 08-15-2023, 12:19 PM
RE: QBJS Swimming fish with Kelp - by dbox - 08-15-2023, 12:53 PM
RE: QBJS Swimming fish with Kelp - by bplus - 08-15-2023, 01:07 PM
RE: QBJS Swimming fish with Kelp - by dbox - 08-15-2023, 01:23 PM
RE: QBJS Swimming fish with Kelp - by bplus - 08-15-2023, 02:41 PM
RE: QBJS Swimming fish with Kelp - by dbox - 08-15-2023, 04:27 PM
RE: QBJS Swimming fish with Kelp - by CharlieJV - 08-15-2023, 05:01 PM
RE: QBJS Swimming fish with Kelp - by dbox - 08-15-2023, 06:38 PM
RE: QBJS Swimming fish with Kelp - by dbox - 08-17-2023, 04:54 PM
RE: QBJS Swimming fish with Kelp - by grymmjack - 08-17-2023, 12:00 AM
RE: QBJS Swimming fish with Kelp - by CharlieJV - 08-18-2023, 11:24 PM
RE: QBJS Swimming fish with Kelp - by grymmjack - 08-17-2023, 12:06 AM
RE: QBJS Swimming fish with Kelp - by bplus - 08-17-2023, 12:14 AM
RE: QBJS Swimming fish with Kelp - by grymmjack - 08-17-2023, 01:20 AM
RE: QBJS Swimming fish with Kelp - by animegame - 08-18-2023, 06:51 PM
RE: QBJS Swimming fish with Kelp - by grymmjack - 08-17-2023, 01:21 AM
RE: QBJS Swimming fish with Kelp - by bplus - 08-17-2023, 07:52 AM
RE: QBJS Swimming fish with Kelp - by bplus - 08-18-2023, 07:50 PM
RE: QBJS Swimming fish with Kelp - by vince - 08-28-2023, 12:43 PM



Users browsing this thread: 7 Guest(s)