Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I know how to round up to the number base 10 but I do not understand here, "multiple of 4"?

and the Question is "round 0xDEA24A20 up to multiple of 4" it is the base 16 not 10.

Could anyone give me some hint?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Suppose the number in question is labeled x:

  1. y := x // 4 (ignore the remainder)
  2. z := x - 4y
  3. If z is less than 2, then your result is 4y. Otherwise, your result is 4y + 4.

Let's use 50 as an example.

x = 50
y = 50 // 4 = 12
z = 50 - 48 = 2

So the result is 4y + 4, which equals 52.

share|improve this answer
    
I realize that my notation may not be perfect, but this is the general process. Please edit where you see appropriate. –  Ataraxia Oct 21 '12 at 3:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.