Discussion

Questions about variable size

2

h 2021-08-15 15:29

How big can I make variables?


was8bit 2021-08-15 15:51 (Edited)

Single variables are easy...

Numbers can be 7 digits long, after that they are converted into #+## format, and lose their precision

Strings$, i am not sure, perhaps thousands long?

Arrays quickly loose memory
Single, up to (32000)
Double, up to (180,180)
Triple, up to (30,30,30)


nathanielbabiak 2021-08-16 13:14 (Edited)

Numbers are single precision floating point.

Arrays are limited to 32768 elements across all dimensions.


nathanielbabiak 2021-08-16 20:16 (Edited)

I just checked strings with this code. There doesn't appear to be a system limit besides clock cycles! I got the string length up to 2^24 before stopping the program. It took just shy of 16 seconds to concatenate the two strings prior at 2^23 each.

T$ = " "
TIME = TIMER
DO
  CLS
  PRINT ( TIMER - TIME ) / 60
  PRINT LEN( T$ )
  TIME = TIMER
  T$ = T$ + T$
LOOP


Timo 2021-08-16 20:39

Strings are just null terminated C strings... I'm surprised I didn't put them a hard limit (like arrays). But usually they don't get so long, I guess...


was8bit 2021-08-17 04:54

The time it can take to process text can be a natural limiter....

For example, if one had the idea if using one string to represent a map of say 2000x1600, it would be 32x10^4

Here is a speed test... it takes time to build the data, but it displays quickly once made!

Text Speed Text.nx | Open in app
2021-08-17 04:54

was8bit 2021-08-17 04:55

Use debug mode to monitor it building the map database...


h 2021-09-11 03:18

imma use this in my game


Log in to reply.