How to convert BCD to Decimal?

Thread Starter

Doraemon

Joined May 21, 2015
13
Converting Decimal to BCD is easy but how do I convert BCD to Decimal when the BCD is like this:

0111100100100010110 (BCD) = 0011 1100 1001 0001 0110 (grouping into 4 bits from right to left)
= 3 12 9 1 6 (converted 4bits binary to decimal)
= 312916 (Final decimal number)


As you can see I've done as per the method but the answer is wrong (tested on online converter), anyone can help me with this? I'll really appreciate it, I googled and found almost all articles about Decimal to Binary. I've no idea what I'm doing wrong.
 

ScottWang

Joined Aug 23, 2012
7,409
Maybe you could pick up the Magical treasures from your pocket and to check the time after the answer you know ... :D

> = 3 12 9 1 6 (converted 4bits binary to decimal)

Try to using the hexadecimal to show them and converting to decimal.
 

Thread Starter

Doraemon

Joined May 21, 2015
13
Maybe you could pick up the Magical treasures from your pocket and to check the time after the answer you know ... :D

> = 3 12 9 1 6 (converted 4bits binary to decimal)

Try to using the hexadecimal to show them and converting to decimal.
I'm writing my assignment since last 7 hours continuously and came across this problem, I'm completely exhausted right now I have 2 days left to submit my assignment XD, Just asked here if someone can provide a solution and save my time.


"Try to using the hexadecimal to show them and converting to decimal."

I don't understand what exactly you're suggesting to do, should I convert those grouped 4 bits to hexadecimal and then convert the hexadecimal to decimal?
 

Thread Starter

Doraemon

Joined May 21, 2015
13
Update: I checked the answer is 3916 but what happens to "12"? Should we ignore the digits larger than 9? I checked the BCD and Decimal table and 12 is represented as 00010010 which is 1 (0001) and 2 (0010) together = 12 (00010010). Any help will be appreciated, I'm really confused right now :(

Update 2: Found this on one website:
Invalid BCD Numbers
These binary numbers are not allowed in the BCD code: 1010, 1011, 1100, 1101, 1110, 1111

So I guess I need to ignore the 1100. And in exam I need to write it like this:

0111100100100010110 = 0011(base2) 1100(base2) 1001(base2) 0001(base2) 0110(base2)
= 3(base10) 9(base10) 1(base10) 6(base10)
= 3916 (base10)
Am I correct? :)
 
Last edited:

ScottWang

Joined Aug 23, 2012
7,409
How come you missing the "12"?

You don't know this - Try to using the hexadecimal to show them and converting to decimal.
I think you need to restudy the hexadecimal if you not study yet.
Try to answer the hexadecimal to decimal as :
Code:
Hex → Dec
---------------
01  →
06  →
09  →
0a  →
0d  →
0f  →

   Hex  →  Dec
-------------
(01+01) →
(09+09) →
(0f+0f) →
Using the "[" + "code" + "]" "[" + "/" + "code" + "]" function to show the math.
If you don't know hexadecimal, then google it.
 

djsfantasi

Joined Apr 11, 2010
9,163
I fail to see how converting to hexadecimal will help. There are 4 bits which are not a BCD value, whether in binary or hexadecimal. 1100 in binary is the same value as 0C in hex. No matter which way you write it, it's not representative of a decimal digit (BCD).

Unfortunately, the problem doesn't state what to do with an invalid value. So it's unclear whether you're correct or not.
 

ScottWang

Joined Aug 23, 2012
7,409
I fail to see how converting to hexadecimal will help. There are 4 bits which are not a BCD value, whether in binary or hexadecimal. 1100 in binary is the same value as 0C in hex. No matter which way you write it, it's not representative of a decimal digit (BCD).

Unfortunately, the problem doesn't state what to do with an invalid value. So it's unclear whether you're correct or not.
You break the balloon as exposing the new clothes of King.
 

Thread Starter

Doraemon

Joined May 21, 2015
13
How come you missing the "12"?

You don't know this - Try to using the hexadecimal to show them and converting to decimal.
I think you need to restudy the hexadecimal if you not study yet.
Try to answer the hexadecimal to decimal as :
Code:
Hex → Dec
---------------
01  →
06  →
09  →
0a  →
0d  →
0f  →

   Hex  →  Dec
-------------
(01+01) →
(09+09) →
(0f+0f) →
Using the "[" + "code" + "]" "[" + "/" + "code" + "]" function to show the math.
If you don't know hexadecimal, then google it.
Okay I think I'm familiar with Hexadecimal, I just started learning 3 days ago. Here is the answers:

Code:
Hex → Dec
---------------
01  → 0 * 16^1   +  1 * 16 ^0  =  1
06  → 0 * 16^1  +  6 * 16 ^0  =  6
09  → 0 * 16^1  +  9 * 16 ^0  =  9
0a  → 0 * 16^1  +  a * 16 ^0  =   10 * 16 ^0 = 10
0d  → 0 * 16^1  +  d * 16 ^0  = 13 * 16^0  =  13
0f  → 0 * 16^1  +  f * 16 ^0   =  15 * 16^0  = 15

   Hex  →  Dec
-------------
(01+01) → 1 + 1 = 2
(09+09) → 9 + 9 = 18
(0f+0f) →15 + 15 = 30
 

Thread Starter

Doraemon

Joined May 21, 2015
13
I fail to see how converting to hexadecimal will help. There are 4 bits which are not a BCD value, whether in binary or hexadecimal. 1100 in binary is the same value as 0C in hex. No matter which way you write it, it's not representative of a decimal digit (BCD).

Unfortunately, the problem doesn't state what to do with an invalid value. So it's unclear whether you're correct or not.
That's what I'm trying to figure out what to do with 12 aka 1100 in binary! :confused:

I belive ScottWang has the answer but he is trying to teach me something I should have known before solving this problem.
 

MrChips

Joined Oct 2, 2009
30,823
What is the difference between the binary representation of a decimal number and the binary representation of a value in BCD?
 

Thread Starter

Doraemon

Joined May 21, 2015
13
What is the difference between the binary representation of a decimal number and the binary representation of a value in BCD?
Binary representation of decimal number 12 in binary will be 1100
While 12 will be denoted as 00010010 in BCD, the numbers after 9, which are 2 digits are represented differently. Each digit will be represented in 4 bits, total 8 bits.
 

MrChips

Joined Oct 2, 2009
30,823
Your original question ought to be:

How to convert from binary to BCD?
along with
How to convert from BCD to binary?

Show us how you convert from BCD to binary.

Note that BCD means binary coded decimal. Which means that it is both binary and decimal at the same time. It is a binary representation of a decimal value.

0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001

There are no values greater than 9.
 

MrChips

Joined Oct 2, 2009
30,823
Make a distinction between the value of a quantity and its representation.
The quantity twelve can be represented in many ways:

binary: 1100
hexadecimal: 0C
decimal: 12
BCD: 0001 0010
 

Thread Starter

Doraemon

Joined May 21, 2015
13
Your original question ought to be:

How to convert from binary to BCD?
along with
How to convert from BCD to binary?

Show us how you convert from BCD to binary.

Note that BCD means binary coded decimal. Which means that it is both binary and decimal at the same time. It is a binary representation of a decimal value.

0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001

There are no values greater than 9.
Okay I'll appreciate it if you can tell me step by step solution of

0111100100100010110 (BCD) = ?(10)

The (BCD) and (10) both are written in small letter in subscript (in base).

That's my question written in my assignment paper :)



"Show us how you convert from BCD to binary."

To convert BCD to binary, first I need to convert BCD into decimal and then convert the decimal into binary as far as I know. But the question is what steps should I take to convert BCD into decimal.
 
Top