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

#1 2013-03-27 08:54:16

thescratchytim
Scratcher
Registered: 2010-09-10
Posts: 25

Can I stop scratch rounding?

In the offline player I''m working on a project that calculates phi and pi. I want to know if there is any way to stop scratch from automatically rounding to 15 d.p., because I want to make my project have the calculated decimal places, not 15. thanks in advance.  smile  Please?

Last edited by thescratchytim (2013-03-27 09:33:03)


Hello! I'm thescratchytim!  Check out my projects here. Scratch on!
Status: http://blocks.scratchr.org/API.php?user=thescratchytim&action=onlineStatus&type=circle • Also, this project seems to be my most successful. I don't know why  tongue

Offline

 

#2 2013-03-27 11:49:26

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Can I stop scratch rounding?

thescratchytim wrote:

In the offline player I''m working on a project that calculates phi and pi. I want to know if there is any way to stop scratch from automatically rounding to 15 d.p., because I want to make my project have the calculated decimal places, not 15. thanks in advance.  smile  Please?

In a single variable, there is no way to just stop rounding. Therefore, you'll have to store your data a different way. One method that you could use is to use your original variable, through now you add a p to the end of the variable to stop rounding. Now, when you're reading the variable, you'll need to ignore (not remove) the p, and you'll have pi!

Now, another method that you could maybe use is to use a list to store your variable. Every item in the list becomes a digit of pi or phi and this way you don't need to worry about rounding.

Just to say, there are a few other methods to accomplish this, though they're not as useful or nice as the two above.

Well I hope that this helps!

With regards,

ErnieParke

Last edited by ErnieParke (2013-03-27 12:02:54)


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer