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

#1 2010-02-14 13:03:00

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

A discovery! How to make more decimals show in the variables.

Sometimes it is necessary for a variable to show a lot of decimals. (For example, if the point of your project is to find pi, you don't want the variable to round to 3.1 or 3.14). Unfortunately, Scratch doesn't give an option of how many places to round to and often round to only 1 or 2 decimal places. I have found a way around this! If you use a join block with your variable, it will show quite a few more places. There does not even have to be anything in the other half of the join block.

Example:
http://img42.imageshack.us/img42/5181/picture1db.png

I hope that makes sense and that it helps you!

Last edited by scmb1 (2010-02-14 19:10:13)


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

Offline

 

#2 2010-02-14 13:55:45

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

That's really strange, but quite cool! I'm goin to try it now!  smile


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

#3 2010-02-14 14:02:58

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

Oh, very cool find!  Very handy - thanks  smile


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2010-02-14 14:11:01

RHY3756547
Scratcher
Registered: 2009-08-15
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

yikes  Ingenious.
This is very useful. Thanks!

Offline

 

#5 2010-02-14 14:40:29

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

Re: A discovery! How to make more decimals show in the variables.

Awesome!


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

Offline

 

#6 2010-02-14 14:56:29

The-Whiz
Scratcher
Registered: 2007-07-09
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

Nice find!

Offline

 

#7 2010-02-14 15:04:50

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

Wow, I'm going to need this!


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#8 2010-02-14 15:29:23

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

Nice, I've never needed more than 2 decimal spots but still, it might be useful sometime  smile


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#9 2010-02-14 16:49:15

Ace-of-Spades
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

There's no pi in scratch.. is there?

Well if you want to be accurate, all you need is 3.141. It's not like a one-thousandth of a decimal place will ever help you.


11110010100011010100011010101000100011011011001010111100101000110101000110101010001000110110110010101111001010001101010001101010100010001101101100101011110010100011010100011010101000100011011011001010
110101010010001010101010101010101010101010100110101010010101010010101001101011010101010010101010101

Offline

 

#10 2010-02-14 17:09:26

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

Re: A discovery! How to make more decimals show in the variables.

Ace-of-Spades wrote:

There's no pi in scratch.. is there?

Well if you want to be accurate, all you need is 3.141. It's not like a one-thousandth of a decimal place will ever help you.

I was just making an example of when you would want a more accurate variable. If the point of your project was to find a lot of digits of pi, you wouldn't want the variable to always round to a digit or 2. There are lots of of other situations too, not just that.

Last edited by scmb1 (2010-02-14 17:10:16)


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

Offline

 

#11 2010-02-14 18:11:31

Ace-of-Spades
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

Haven't you ever heard of significant digits? It's marks off in high school if you have more than 2 after the decimal point (or 3 in Chemistry)


11110010100011010100011010101000100011011011001010111100101000110101000110101010001000110110110010101111001010001101010001101010100010001101101100101011110010100011010100011010101000100011011011001010
110101010010001010101010101010101010101010100110101010010101010010101001101011010101010010101010101

Offline

 

#12 2010-02-14 18:29:09

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

Re: A discovery! How to make more decimals show in the variables.

Ace-of-Spades wrote:

Haven't you ever heard of significant digits? It's marks off in high school if you have more than 2 after the decimal point (or 3 in Chemistry)

Yes, I've heard of significant digits...

If you don't find this useful, then don't use it.

Last edited by scmb1 (2010-02-14 18:29:24)


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

Offline

 

#13 2010-02-15 01:22:15

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

Wow! I always used lists.  tongue


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#14 2010-02-15 01:33:33

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

This is brilliant! Thanks, scmb1!  big_smile


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#15 2010-02-15 08:40:59

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

Re: A discovery! How to make more decimals show in the variables.

Ace-of-Spades wrote:

There's no pi in scratch.. is there?

Well if you want to be accurate, all you need is 3.141. It's not like a one-thousandth of a decimal place will ever help you.

To be accurate you need 3.14159265  tongue  Or 3.756547 XD


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

Offline

 

#16 2010-02-15 08:57:26

Ace-of-Spades
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

Lucario621 wrote:

Ace-of-Spades wrote:

There's no pi in scratch.. is there?

Well if you want to be accurate, all you need is 3.141. It's not like a one-thousandth of a decimal place will ever help you.

To be accurate you need 3.14159265  tongue  Or 3.756547 XD

You're not old enough for architecture or engineering desgin class, so how would you know?


11110010100011010100011010101000100011011011001010111100101000110101000110101010001000110110110010101111001010001101010001101010100010001101101100101011110010100011010100011010101000100011011011001010
110101010010001010101010101010101010101010100110101010010101010010101001101011010101010010101010101

Offline

 

#17 2010-04-13 14:37:24

aliceteaparty
Scratcher
Registered: 2008-03-28
Posts: 3

Re: A discovery! How to make more decimals show in the variables.

Hiya - Great work-around - thank-you.
BTW:
1. You need to click on the join block after you insert it to "activate" it.
2. Better to put variable V in first block and 1 blank space in second block.
3. You can get exactly N decimals by using: round( V * 10^N ) / 10^N
---
Also, I did notice that without work-around:
If I share or embed I automatically get more decimal places in the display.
However, if I just present, I only get the 1 decimal point which is not enough and have to use this cool but rather awkward work around (I want my students to program.)
Any new developments here expected in newer version?
---
Again MANY THANKS!

Offline

 

#18 2010-04-13 17:12:05

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

Re: A discovery! How to make more decimals show in the variables.

aliceteaparty wrote:

Hiya - Great work-around - thank-you.
BTW:
1. You need to click on the join block after you insert it to "activate" it.
2. Better to put variable V in first block and 1 blank space in second block.
3. You can get exactly N decimals by using: round( V * 10^N ) / 10^N
---
Also, I did notice that without work-around:
If I share or embed I automatically get more decimal places in the display.
However, if I just present, I only get the 1 decimal point which is not enough and have to use this cool but rather awkward work around (I want my students to program.)
Any new developments here expected in newer version?
---
Again MANY THANKS!

No problem! And thanks for sharing your discoveries! Sorry, but I don't know if there are any plans to change the decimal rounding in 2.0...


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

Offline

 

#19 2010-05-16 05:06:13

Samueldora
Scratcher
Registered: 2009-07-19
Posts: 90

Re: A discovery! How to make more decimals show in the variables.

Hi scmb1!

This was exactly what I needed for a project. Thank you very much for sharing this trick.

smile

Samueldora

Offline

 

#20 2010-05-16 15:28:02

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

Re: A discovery! How to make more decimals show in the variables.

Samueldora wrote:

Hi scmb1!

This was exactly what I needed for a project. Thank you very much for sharing this trick.

smile

Samueldora

No problem!


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

Offline

 

#21 2010-05-16 15:28:57

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: A discovery! How to make more decimals show in the variables.

Very helpful! I've never really needed to have a lot of decimal places, but this is helpful should that day ever come  smile

Last edited by coolstuff (2010-05-16 15:29:47)

Offline

 

Board footer