If I have a small number specified as a constant after I save the file the constant will be shown in exponent notation which scratch doesn't seem to be able to handle very well. It's also happening to projects that I've uploaded to the website after they have been downloaded.
It is real easy to reproduce. Place any block that requires a number and use any number smaller than 0.000099 and when you save the project it will show up in exponent form.
This is an example of a program that fails to run correctly after it has been downloaded or saved:
http://scratch.mit.edu/projects/Canthiar/6123
Offline
The situation is worse than Canthiar said.
I had a program that worked fine. In it there was a block that said
if error < 0.0000001
scratch changed that to
if error < 1.e-6
which is fine with me (though it had the number positioned wrong in the box)
The program worked fine, but when I saved the program, it changed the 1.e-6 to 1.
I think that the "save" command does some "cleanup" of the number fields incorrectly, getting rid of the scientific notation that scratch itself had put in.
When a variable gets large, scientific notation is used in the variable display also (which would be ok, if it didn't spill outside the box for the variable).
You can play with the variable display problems with my RPN calculator
http://scratch.mit.edu/projects/kevin_karplus/2164
which now has x^2 and sqrt as well as sin,cos,tan, arcsin, arccos, arctan.
Offline
I think the reason is, that SCRATCH simple uses the SQUEAK method "Number>>printString" for displaying numbers and "printString" shows small numbers in scientific notation, that SCRATCH doesn't implement.
At http://scratch.mit.edu/projects/Canthiar/7369
we discussed this matter and found a "workarround":
CanthiarCanthiar 1 month, 1 week ago
Martin, I do know what the problem is. There is a bug in scratch when it reads files that have a small number in them. You're going to have to delete every ball except one. Then 3/4 into the ball code and you should see [set result to ((result) + ((angle power) * (2.5e-5)))]. Change the 2.5e-5 to 0.000025. Then click on the copy button, hold down the shift key and click on the ball sprite several times.
MartinWollenweberMartinWollenweber 1 month, 1 week ago
Canthiar, thank you very much! It worked immediately. Who could think of this? Did you already report the bug to the SCRATCH-Makers? I wished the Squeak-Smalltalk-Source-Code of SCRATCH would have been published already (it's said to be published end of 2007), than we had a chance to fix those kind of bugs ourself. Furthermore you could implement trigonometrically functions and other stuff (your replacement for that in "Bouncing Balls" is great!). It would be wonderfull to have a SCRATCH that you could parameterise from "beginner" to "pro": So students could start with a few concepts and got more and more up to a fully Smalltalk-like environment. What do you think?
MartinWollenweberMartinWollenweber 1 month, 1 week ago
Addendum: After saving an loading the problem is back again: You can't save the current version "Bouncing Balls" with SCRATCH 1.1! You have to carry out your above correction every time after loading it! A work-around is writing: "25/1000000" instead of "0.000025" (but that costs some calculatingtime). You have 0.000025 also in the last line of your "cos"-function in your math-library-sprite.
Last edited by MartinWollenweber (2007-07-19 11:07:05)
Offline
I have no quibble with showing numbers in scientific notation, but scratch's inability to read its own saved files correctly is clearly a hideous bug.
Offline