I suggest
Math.ceil() and Math.floor() functions to be added to math functions in scratch2.0 (i know this is last minute advice but still they are very very useful)
For those who dont know what Math.ceil() and Math.Floor() functions are, Math.floor() gives the greatest integer which is less the given number
say
Math.floor(2.5) = 2
Math.floor(2.9) = 2
and Math.ceil() is reverse of Math.floor() :: i.e; it gives the smallest integer greater then the given integer
Math.ceil(3.1) = 3
Math.ceil(3.6) = 3
Offline
Meet the <round( [/blocks] block.
Offline
scimonster wrote:
Meet the <round( [/blocks] block.
![]()
Round block is USELESS!
I mean declare a 2 dimensional array by making a single array Row major and then u will find out why i actually need floor and ceil... o btw its also a feature in 99.999% of coding languages C , C++ , C# , D , Python .. each nd everything has a feature like that
the difference between Ceil / Floor and Round block is ::
Round will give closest integer regardless if its greater or smaller
and to make something like ceil u will have to do
if(Round(X) < X)
{
X = Round(X) +1;
}
else
{
X = Round(X) ;
}
Which SLOWS DOWN YOUR PROGRAM!!!!!
Last edited by fanofcena (2011-05-04 08:51:47)
Offline
fanofcena wrote:
scimonster wrote:
Meet the <round( [/blocks] block.
![]()
Round block is USELESS!
I mean declare a 2 dimensional array by making a single array Row major and then u will find out why i actually need floor and ceil... o btw its also a feature in 99.999% of coding languagesC , C++ , C# , D , Python .. each nd everything has a feature like that
the difference between Ceil / Floor and Round block is ::
Round will give closest integer regardless if its greater or smaller![]()
and to make something like ceil u will have to do
if(Round(X) < X)
{
X = Round(X) +1;
}
else
{
X = Round(X) ;
}
Which SLOWS DOWN YOUR PROGRAM!!!!!
I knew about the code you told me.
I also know that it slows down the program.
However, I don't think the Scratch Team wants to add a million blocks into Scratch 2.0
Offline
scimonster wrote:
fanofcena wrote:
scimonster wrote:
Meet the <round( [/blocks] block.
![]()
Round block is USELESS!
I mean declare a 2 dimensional array by making a single array Row major and then u will find out why i actually need floor and ceil... o btw its also a feature in 99.999% of coding languagesC , C++ , C# , D , Python .. each nd everything has a feature like that
the difference between Ceil / Floor and Round block is ::
Round will give closest integer regardless if its greater or smaller![]()
and to make something like ceil u will have to do
if(Round(X) < X)
{
X = Round(X) +1;
}
else
{
X = Round(X) ;
}
Which SLOWS DOWN YOUR PROGRAM!!!!!I knew about the code you told me.
I also know that it slows down the program.
However, I don't think the Scratch Team wants to add a million blocks into Scratch 2.0![]()
I think this block is needed lol
Offline
scimonster wrote:
fanofcena wrote:
scimonster wrote:
Meet the <round( [/blocks] block.
![]()
Round block is USELESS!
I mean declare a 2 dimensional array by making a single array Row major and then u will find out why i actually need floor and ceil... o btw its also a feature in 99.999% of coding languagesC , C++ , C# , D , Python .. each nd everything has a feature like that
the difference between Ceil / Floor and Round block is ::
Round will give closest integer regardless if its greater or smaller![]()
and to make something like ceil u will have to do
if(Round(X) < X)
{
X = Round(X) +1;
}
else
{
X = Round(X) ;
}
Which SLOWS DOWN YOUR PROGRAM!!!!!I knew about the code you told me.
I also know that it slows down the program.
However, I don't think the Scratch Team wants to add a million blocks into Scratch 2.0![]()
They can combine these functions into one block.
Offline
Harakou wrote:
You can actually replicate this with the round block pretty easily. Math.floor( ) would be [Round ( ) - 0.5], and Math.ceil( ) would be [Round ( ) + 0.5].
I know but wont it slow down ??? a bit ???
Offline
nope[Round ( ) - 0.5], [Round ( ) + 0.5] are perfect substitutes. What is more needed is ATAN2, aside from that scratch pretty much has all the math functions it needs.
Offline
Actually, for the one that turns 3.6 into 3, you could do: (letter 1 of number). It works for single digits, but for 40.2, you need to do (join (letter 1 of number) (letter 2 of number) and so on for triple-digits etc.
Offline
archmage wrote:
nope[Round ( ) - 0.5], [Round ( ) + 0.5] are perfect substitutes. What is more needed is ATAN2, aside from that scratch pretty much has all the math functions it needs.
Ah yes sir!!!!!!!!!!!!!!!!!!! Atan2 is really needed!! (actually they should add something like Header files in C++ and leave us to create atomic blocks as perneed lol)
Offline
Actually, for the one that turns 3.6 into 3, you could do: (letter 1 of number). It works for single digits, but for 40.2, you need to do (join (letter 1 of number) (letter 2 of number) and so on for triple-digits etc.
Meet the (rdococ's solution) block, as it reports what's in the quote.
Offline
I think we should have a percent of block.
Example:
()% of ()
if answer= (p)% of (b)
(whatever happens when you get the problem right)
else
(whatever happens when you get the problem wrong)
My little brother is in fourth grade and my little sister is in fifth and it would be very useful to make learning percents fun for them! That way, I could add percents to my math games.
Last edited by LolCat72 (2011-05-07 10:37:17)
Offline
LolCat72 wrote:
I think we should have a percent of block.
Example:
()% of ()
if answer= (p)% of (b)
(whatever happens when you get the problem right)
else
(whatever happens when you get the problem wrong)
My little brother is in fourth grade and my little sister is in fifth and it would be very useful to make learning percents fun for them! That way, I could add percents to my math games.
But that's not that hard to make... just use if (answer)/(b) = (p).
Offline
If you're saying it's easy to go without, why do we have forever if?
Offline
Harakou wrote:
LolCat72 wrote:
I think we should have a percent of block.
Example:
()% of ()
if answer= (p)% of (b)
(whatever happens when you get the problem right)
else
(whatever happens when you get the problem wrong)
My little brother is in fourth grade and my little sister is in fifth and it would be very useful to make learning percents fun for them! That way, I could add percents to my math games.But that's not that hard to make... just use if (answer)/(b) = (p).
Huh? Why does that work? What does that have to do with percents?
EDIT: Nevermind, I see
Last edited by LolCat72 (2011-05-07 19:41:23)
Offline
juststickman wrote:
If you're saying it's easy to go without, why do we have forever if?
I don't know.
Offline