Discuss Scratch

mrvankil
Scratcher
100+ posts

variable size

what is the largest number of digits a variable can be?

what is the largest number of digits a cloud variable can be?
VoltageGames
Scratcher
1000+ posts

variable size

cloud variables have a character limit of ~10245 iirc.
i'm fairly certain regular variables are limitless, but what would you even do with a variable set to (insert nine trillion nines here)?
mrvankil
Scratcher
100+ posts

variable size

VoltageGames wrote:

cloud variables have a character limit of ~10245 iirc.
i'm fairly certain regular variables are limitless, but what would you even do with a variable set to (insert nine trillion nines here)?

i dont know what i would do with it i really just wanted to know how large clouds can be but thought i would also check to see if regular ones are larger than say sixteen digits for example. I noticed that griffpatch saved his who visited this site project entirely into one cloud variable and it was very large and i wanted to know what the upper limit was.
mrvankil
Scratcher
100+ posts

variable size

VoltageGames wrote:

cloud variables have a character limit of ~10245 iirc.
i'm fairly certain regular variables are limitless, but what would you even do with a variable set to (insert nine trillion nines here)?

oh and thanks that answered my question.
Zro716
Scratcher
1000+ posts

variable size

Variables by themselves have no limit. It's the join block that imposes a limit of 10240 characters max for the resulting combined string. Some of us have worked around this by casting a list to a string using its reporter - though this can only be achieved when all the items of a list are 1-length strings (hint, use the letter-of block).
mrvankil
Scratcher
100+ posts

variable size

Zro716 wrote:

Variables by themselves have no limit. It's the join block that imposes a limit of 10240 characters max for the resulting combined string. Some of us have worked around this by casting a list to a string using its reporter - though this can only be achieved when all the items of a list are 1-length strings (hint, use the letter-of block).

thats interesting do you have a project that uses what you are talking about that i could look at?
Arthurtilly
Scratcher
1000+ posts

variable size

I'm pretty sure all variables have a limit of 65536 (or possibly 1 less) as they can't be stored in the source code of Scratch if they're any bigger.
liam48D
Scratcher
1000+ posts

variable size

Note numbers don't operate near as well after 14 or 15 digits.
DadOfMrLog
Scratcher
1000+ posts

variable size

Variables can easily be millions of characters long. Here's an example of a project that holds encoded video frames as over 5 million unicode characters within a single variable: https://scratch.mit.edu/projects/83967960/

Note, though, that there is a limit to the size of an uploaded project. Since the var in that project contains unicode characters, it actually takes about 8MBytes of storage (many unicode chars are 2 bytes long). IIRC, the limit for a project is 10Megs, so you can't get that much larger without running into problems saving the project online (or is the limit maybe 20Megs??)

As Zro says above, it's only the “join” block that imposes the limit of 10240 characters.


Cloud vars are no different to normal vars in this respect, and so can also be made to hold millions of digits. However, there's a practical limit of probably a million digits (maybe less, maybe more, depending what you're doing with it).

The reason is because it takes time to download the data (for me it's about 2-3 secs per million digits). But, more importantly, it takes time to upload a change for a cloudvar to the cloud server (likely a few times longer than download, so about 10 secs or so for a million digits).

There are numerous possible scenarios I can imagine where taking so long to upload a cloudvar (and then a couple more secs for each person to download the change) would really not work well with a project that's being run by multiple users at the same time…


Oh, and, yes… as also mentioned above, if you're using the variables as numerical values (i.e. operating on them with mathematical operators, rather than as a string of characters, with the “letter of” block), then the accuracy is about 14-15 digits. If you use maths operators then you should not expect anything meaningful after about the 14th digit…

Last edited by DadOfMrLog (Oct. 27, 2015 17:40:49)

jason151202_
Scratcher
65 posts

variable size

I susceed 173641 digits(string)
Random_Tests-
Scratcher
14 posts

variable size

Well, well, well. Lookie here…
cookedasparagus8
Scratcher
1000+ posts

variable size

jason151202_ wrote:

I susceed 173641 digits(string)

Random_Tests- wrote:

Well, well, well. Lookie here…
Reported to be closed due to necroposting.

Powered by DjangoBB