How to convert BCD to Decimal?

ScottWang

Joined Aug 23, 2012
7,400
Thank you, I already knew that, I believe the question is wrong in my assignment paper, it should be 20bits or 16bits not 19 bits long (1 decimal number is represented in 4 bits so).
The big problem is that the BCD code is the decimal show in binary format, so only can be show 0~9, any number over 9 is wrong, so discussing a long strings just doing the same problem the number was limited in 0~9.
 

ScottWang

Joined Aug 23, 2012
7,400
His teacher may cry for his fault and then maybe he need to send the score to the students or do some homework before he give another homework to the students.
 

atferrari

Joined Jan 6, 2004
4,770
Maybe the teacher is expecting them to catch that particular error.

I recall a teacher dropping a space in an Excel's cell. Some few students were smart enough to discover why their work did not produce the expected results.
 

WBahn

Joined Mar 31, 2012
30,060
I agree that the problem has an error in it. The best you can do is to indicate that the BCD representation is invalid, just like if you were asked to convert 12P4 from decimal to binary. There IS no reasonable solution. Since you know that the answer is supposed to be 3916, you can show what that would be in BCD and show that the error appears to be the insertion of 1100 into the BCD representation.

Don't worry too much about the missing leading 0. That's not much of an issue and it might actually be the case in hardware. For instance, many instruments have a display for which the leftmost digit can only take on values 0, 1, 2, and 3. If those instruments stored values in BCD, the first two bits of that leftmost digit might not be stored at all, but simply be inferred as zero.
 

Thread Starter

Doraemon

Joined May 21, 2015
13
Then, I propose the best answer is that

\((0111 1001 0010 0010 110) _{BCD} = Nothing in _{Decimal}\)...
That's hilarious XD

His teacher may cry for his fault and then maybe he need to send the score to the students or do some homework before he give another homework to the students.
lol, I watched almost every video on youtube about BCD and read many articles and notes and stuff related to BCD thinking that I was doing something wrong.

Maybe the teacher is expecting them to catch that particular error.

I recall a teacher dropping a space in an Excel's cell. Some few students were smart enough to discover why their work did not produce the expected results.
If they should have asked like "Can this number be converted into decimal?" or "is this a valid BCD number?" it would be much better :)


I agree that the problem has an error in it. The best you can do is to indicate that the BCD representation is invalid, just like if you were asked to convert 12P4 from decimal to binary. There IS no reasonable solution. Since you know that the answer is supposed to be 3916, you can show what that would be in BCD and show that the error appears to be the insertion of 1100 into the BCD representation.

Don't worry too much about the missing leading 0. That's not much of an issue and it might actually be the case in hardware. For instance, many instruments have a display for which the leftmost digit can only take on values 0, 1, 2, and 3. If those instruments stored values in BCD, the first two bits of that leftmost digit might not be stored at all, but simply be inferred as zero.
Okay :)
 
Top