Pages: 1
Topic closed
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:
I hope that makes sense and that it helps you!
Last edited by scmb1 (2010-02-14 19:10:13)
Offline
That's really strange, but quite cool! I'm goin to try it now!
Offline
Oh, very cool find! Very handy - thanks
Offline
Ingenious.
This is very useful. Thanks!
Offline
Wow, I'm going to need this!
Offline
Nice, I've never needed more than 2 decimal spots but still, it might be useful sometime
Offline
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.
Offline
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)
Offline
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)
Offline
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)
Offline
This is brilliant! Thanks, scmb1!
Offline
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 Or 3.756547 XD
Offline
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
Or 3.756547 XD
You're not old enough for architecture or engineering desgin class, so how would you know?
Offline
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
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...
Offline
Hi scmb1!
This was exactly what I needed for a project. Thank you very much for sharing this trick.
Samueldora
Offline
Very helpful! I've never really needed to have a lot of decimal places, but this is helpful should that day ever come
Last edited by coolstuff (2010-05-16 15:29:47)
Offline
Topic closed
Pages: 1