Pages: 1
Topic closed
I just found this while working on a calculator in Scratch.
If you want to turn a scientific input (perhaps asked with the ask block) into a normal number Squeak can process, you simply do this:
((number) - (0))It turns 3e3 into 3000, 1e1 into 10, etc. This also works with fractions:
Offline
Cool! I never knew that!
Offline
Yep! I didn't know about it until I stepped upon something -- doing some mathematical random stuff in my calculator, I tried 3.3e3 in a sum and it worked! So I messed around a little, and found this out!
Offline
Nice find rdococ! I'll be sure to include this in the Scratch Wiki.
Offline
Yay! Someone puts my discovery in the Scratch Wiki!
Offline
After doing a few tests, it seems that you can also do the following:
((number) + (0)) ((number) / (1)) ((number) * (1))And they will have the same effect.
Offline
Lucario621 wrote:
After doing a few tests, it seems that you can also do the following:
((number) + (0)) ((number) / (1)) ((number) * (1))And they will have the same effect.
Yep -- any mathematical function will work.
Offline
You can see here I added a section about scientific numbers. I also added a similar section to the articles for other mathematical operations.
Offline
Topic closed
Pages: 1