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

#1 2010-05-01 18:08:53

badwolf14
Scratcher
Registered: 2008-08-14
Posts: 2

Decimal places on variables

Is it possible to set variables so they will read to multiple decimal places? I have managed to get it to one, but I would like two or three.

Offline

 

#2 2010-05-01 18:18:28

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

Re: Decimal places on variables

So, you mean if I had a variable that was 9.01257969, you would like it to read 9.0125?

Offline

 

#3 2010-05-01 19:08:08

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

Re: Decimal places on variables

As a matter of fact, yes! Here's the script for it:

http://img179.imageshack.us/img179/4823/roundtodecimals.gif

If you have any questions, please ask. If you just want as many decimal places as possible, don't bother with all of the 10^()'s. Just join the number to nothing.

Oops! I just noticed I spelled "due" wrong in that first comment. Oh well- you know what I mean  smile  .

Last edited by scmb1 (2010-05-02 12:29:49)


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

Offline

 

#4 2010-05-02 11:00:03

laser100
Scratcher
Registered: 2009-12-04
Posts: 100+

Re: Decimal places on variables

Oh, this is interesting. execpt for 1.89 = 1.89000000000000001.

(didn't know how many zeros.)

Also occasinally, when i type in 1.86 in a motion block, it turns into 1.85999999999

Interesting.  cool

Offline

 

Board footer