MathOverflow will be down for maintenance for approximately 3 hours, starting Monday evening (06/24/2013) at approximately 9:00 PM Eastern time (UTC-4).
0

Hi I need to know how the equation below works.

So I have a number line 0 to 21 each cell is divided into 3 units so 0-2 belongs to first unit, 3-5 belongs to the second unit and so on. This 3 unit cell is further divided into 2 unit cells. So what you want to determine is given a number within this line, which 2 unit block this number belongs to.

Example, if you have 10 10/3=3.333.... and so we know that 10 belongs to the 3rd block and now we need to determine where in this 3rd block 10 belongs to (remember the cell is further divided into 2 units) so the correct equation is ((int)(10/3)*2)/2 = 3 so we know that 10 belongs to the 3rd block first section. If you have 11, ((int)(11/3)*2)/2 = 3.5 so we know that this number belongs to the second block of the block 3. Could someone please explain why does ((int)(11/3)*2)/2 this equation works?

Thanks

flag
Note that (int) removes all the decimal point. You're converting a number to Java int type. – kozukiko Jun 3 2011 at 3:05
Your question is more suitable for math.stackexchange – Will Jagy Jun 3 2011 at 3:08
I just posted a same question on math.stachexchange. Thanks for the suggestion. – kozukiko Jun 3 2011 at 3:12

closed as too localized by Will Jagy, algori, Dan Petersen, Andres Caicedo, fedja Jun 3 2011 at 3:43

Browse other questions tagged or ask your own question.