Discuss Scratch

TriforceMayhem
Scratcher
27 posts

More Round block capabilities

Right now the Round block looks like this:
 (round ()) 
This block could use some more options. Right now, it only rounds to the nearest whole number.
It could be expanded to this:
 (round () to the nearest [ v]) 
It could have options like: Nearest ten, nearest tenth, nearest thousandth, etc.
The default option would be the nearest whole number, because if it was something different, it could mess up a large quantity of projects.

I hope you take this idea into consideration!

Have a wonderful time coding!
~TriforceMayhem

Last edited by TriforceMayhem (June 25, 2016 18:04:48)

ProjectMaker59
Scratcher
500+ posts

More Round block capabilities

Semi-support, Sorry
Workaround:
((round ((round what :: grey) / (to the nearest :: grey))) * (to the nearest :: grey))
// If you don't mean that then
((round ((round what :: grey) / (0.1))) * (0.1))
((round ((round what :: grey) / (0.01))) * (0.01))

Last edited by ProjectMaker59 (June 25, 2016 18:06:02)

humantorch01
Scratcher
85 posts

More Round block capabilities

It would be nice to have the
(round ())
be able to be to the nearest one, tenth, hundredth, etc. It would look like this:
(round () to the nearest [tenth v]::operators)
I hope you consider this as it would be very useful.

Last edited by humantorch01 (Oct. 10, 2016 16:50:52)

Sheep_maker
Scratcher
1000+ posts

More Round block capabilities

A workaround for now:
((round((#::grey)*(10)))/(10))
awesome-llama
Scratcher
1000+ posts

More Round block capabilities

(round () to the nearest [tenth v]::operators) //75% support
Do this to make it green:
(round () to the nearest [tenth v]::operators) 
powercon5
Scratcher
1000+ posts

More Round block capabilities

While you can use the worka-round it would be nice to have a simple block. It would also not add extra blocks to scratch as you could replace the current one.
Maybe
(round () to () places::operators) 
?

Last edited by powercon5 (Oct. 10, 2016 08:39:26)

humantorch01
Scratcher
85 posts

More Round block capabilities

Bump!
stickfiregames
Scratcher
1000+ posts

More Round block capabilities

powercon5 wrote:

While you can use the worka-round it would be nice to have a simple block. It would also not add extra blocks to scratch as you could replace the current one.
Maybe
(round () to () places::operators) 
?
(round (...) to nearest (0.1) :: operators)
would be even better if it's possible, because you wouldn't be limited to powers of 10. Unfortunately, it might not work because numbers like 0.1 can't be represented exactly, and that might cause rounding errors.
humantorch01
Scratcher
85 posts

More Round block capabilities

stickfiregames wrote:

powercon5 wrote:

While you can use the worka-round it would be nice to have a simple block. It would also not add extra blocks to scratch as you could replace the current one.
Maybe
(round () to () places::operators) 
?
(round (...) to nearest (0.1) :: operators)
would be even better if it's possible, because you wouldn't be limited to powers of 10. Unfortunately, it might not work because numbers like 0.1 can't be represented exactly, and that might cause rounding errors.
That's why I think there should be a loadout of what you want it to be rounded to:
(round ()to the nearest [tenth, hundredth, etc. v] ::operators)
dvargasews
Scratcher
500+ posts

More Round block capabilities

In general the workaround for
round (x) to the nearest 1/(n)ᵗʰ  ::operators reporter
is
((round ((x)*(n)))/(n))
humantorch01
Scratcher
85 posts

More Round block capabilities

dvargasews wrote:

In general the workaround for
round (x) to the nearest 1/(n)ᵗʰ  ::operators reporter
is
((round ((x)*(n)))/(n))
Yes but it is time consuming
Tymewalk
Scratcher
1000+ posts

More Round block capabilities

powercon5 wrote:

While you can use the worka-round it would be nice to have a simple block. It would also not add extra blocks to scratch as you could replace the current one.
Maybe
(round () to () places::operators) 
?
I support this idea.
duckboycool
Scratcher
1000+ posts

More Round block capabilities

No support, as others have said.
(round (((Input::grey) * (Factor::grey)) /(Factor::grey)))
humantorch01
Scratcher
85 posts

More Round block capabilities

duckboycool wrote:

No support, as others have said.
(round (((Input::grey) * (Factor::grey)) /(Factor::grey)))
Sure but it is too time consuming. And most users new to scratch will not understand that.
duckboycool
Scratcher
1000+ posts

More Round block capabilities

humantorch01 wrote:

duckboycool wrote:

No support, as others have said.
(round (((Input::grey) * (Factor::grey)) /(Factor::grey)))
Sure but it is too time consuming. And most users new to scratch will not understand that.
It is very simple and is 3 blocks. I feel neither of those are true.
humantorch01
Scratcher
85 posts

More Round block capabilities

duckboycool wrote:

humantorch01 wrote:

duckboycool wrote:

No support, as others have said.
(round (((Input::grey) * (Factor::grey)) /(Factor::grey)))
Sure but it is too time consuming. And most users new to scratch will not understand that.
It is very simple and is 3 blocks. I feel neither of those are true.
Then I guess we have different views
jromagnoli
Scratcher
1000+ posts

More Round block capabilities

This is actually a pretty good idea. As for the workaround, I hate to sound dumb, but I never thought of that. Also maybe you could add:
(round () to the nearest [tenth v]::operators)
(round () to the nearest [hundreth v]::operators)
(round () to the nearest [thousandth v]::operators)
And leave it at that.
WolfCat67
Scratcher
1000+ posts

More Round block capabilities

Hmm… Maybe the block could look like this?
round (15.12901928571) to nearest [thousandth v] :: operators reporter
It should also be able to do this:
round (15.12901928571) to nearest [ten v] :: operators reporter
This would allow it to not only round to decimal places, but also numbers like 10, 100, etc.
customhacker
Scratcher
1000+ posts

More Round block capabilities

Semi - Support, there is a workaround, though slightly more complicated.
redgreenandblue
Scratcher
100+ posts

More Round block capabilities

I think it should be more like
(round () to the nearest ()::operators)
so you can do things like
(round (23) to the nearest (12)::operators)
This would report 24

Last edited by redgreenandblue (Feb. 1, 2017 15:24:43)

Powered by DjangoBB