This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-02-24 13:54:56

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

How to turn a scientific number (e.g. 3.3e3) into a normal number

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:

3.0e3 turns into 3000.0 aswell.

I hope you make use of this kind-of bug to help you with any scientific projects!

Offline

 

#2 2012-02-24 14:24:18

ProgramCAT
Scratcher
Registered: 2011-12-13
Posts: 500+

Re: How to turn a scientific number (e.g. 3.3e3) into a normal number

yikes 
Cool! I never knew that!


Programming is an art...
Goodbye, Scratch. I am leaving because of the exams coming up at our school, though I'll check the forums once or twice a week.

Offline

 

#3 2012-02-24 14:31:34

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: How to turn a scientific number (e.g. 3.3e3) into a normal number

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

 

#4 2012-02-24 14:32:58

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: How to turn a scientific number (e.g. 3.3e3) into a normal number

Nice find rdococ! I'll be sure to include this in the Scratch Wiki.  wink


http://i.imgur.com/WBkM2QQ.png

Offline

 

#5 2012-02-24 14:40:41

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Offline

 

#6 2012-02-24 14:50:15

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: How to turn a scientific number (e.g. 3.3e3) into a normal number

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.  smile


http://i.imgur.com/WBkM2QQ.png

Offline

 

#7 2012-02-24 14:52:42

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: How to turn a scientific number (e.g. 3.3e3) into a normal number

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.  smile

Yep -- any mathematical function will work.

Offline

 

#8 2012-02-24 15:16:30

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: How to turn a scientific number (e.g. 3.3e3) into a normal number

You can see here I added a section about scientific numbers. I also added a similar section to the articles for other mathematical operations.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#9 2012-02-24 16:53:15

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: How to turn a scientific number (e.g. 3.3e3) into a normal number

Wow, awesome! I'm jealous I didn't find that.  tongue


http://i48.tinypic.com/2z5pqad.png

Offline

 

Board footer