0

Using 8 bit registers and signed magnitude representation. I thought 25 in BCD is 010 0101 but my text book says it as 001 1001. Can somebody explain?

Sam
  • 69
  • 1
  • 4
  • 12
  • 1
    Is the question about binary addition, or BCD? They are very different representations. Your BCD representation is correct, and your book is the correct representation of 25 in base 2. – StuartLC May 02 '14 at 05:21
  • oh yes its about binary addition which is right after the BCD chapter so i thought we need to convert to BCD and then add it(nothiing was mentioned). thanks a lot..i've got it – Sam May 02 '14 at 05:27

1 Answers1

0

25 / 2 = 12r1 (12 with a remainder of 1)

12 / 2 = 6r0 (6 with a remainder of 0)

6 / 2 = 3r0 (3 with a remainder of 0)

3 / 2 = 1r1 (1 with a remainder of 0)

1 / 2 = 0r1 (0 with a remainder of 0)

So 11001 (working backward up the tree) is the binary equivalent to 25.

Another way to think about it is with powers of 2:

(1*16) + (1*8) + (0*4) + (0*2) + (1*1) = 25

And it's worth noting, just as in base 10, leading zeros do not change the value of a number. (00025 == 25) (0011001 == 11001).

The leading zeros are there in your case because your needing to populate an 8 bit register (there needs to be 8 binary digits regardless of their value).

sfletche
  • 47,248
  • 30
  • 103
  • 119
  • oh so while addition i need to convert into just Binary number and not BCD right? thanks a lot :) – Sam May 02 '14 at 05:22
  • @Prantik, don't just say thanks; accept the answer by clicking the check button below voting button to show your appreciation. – Rahul May 02 '14 at 05:28