Recently I posted an infinite array system, which works primarily using the MOD and 10^ functions in Scratch. However, I've noticed a bug in this, which I think might actually be Scratch's fault. This is best illustrated with an example:
Let's say I have the number 1.2345678901e10 (12345678901), and I want to retrieve 4 digits from the 10th point in the array. Scratch reads this as 1e10, instead of 1000 as I want it to.
The project is linked below:
http://scratch.mit.edu/projects/S65/168910
If you can find a problem in my code, or come up with a workaround, please tell me.
Offline
I identified a problem with the 10^ function in the online Java player a while back. It would hang the project. I don't know if that has been resolved.
Also, I don't see how you are going to get more then 15 or 16 digits of information to store in a single Scratch variable. They don't hold any more than that, that's all the bytes they have. Yes, they can hold very large numbers using scientific notation, but the accuracy of those numbers is only 15 or 16 digits. Unless you are using multiple variables?
Offline
Paddle2See wrote:
They don't hold any more than that, that's all the bytes they have. Yes, they can hold very large numbers using scientific notation, but the accuracy of those numbers is only 15 or 16 digits. Unless you are using multiple variables?
Really? That's probably the problem...I did some automated tests, and the theoretical max for this was 305 digits before it crashed, but the reading accuracy wasn't very good at over position 10 of reading, and produced garbage. I'll try to adapt the system to multiple variables then, and optimize the system further.
Also, this problem occurs in the Scratch IDE too.
Last edited by S65 (2008-05-20 19:51:12)
Offline
Bear in mind also, if you are using the "round" function to get your modded number into a single digit, "round" rounds to the nearest, not downwards.
So the 4th digit of 1923 would read as 2, not 1.
Offline