Converting decimal fraction to BCD

Thread Starter

TsAmE

Joined Apr 19, 2010
72
Convert the following decimal numbers to their 8421 BCD equivalents:

99.9

Attempt:

I was able to convert 99 (1001 1001) but i am not sure how you would convert 0.9
 

Papabravo

Joined Feb 24, 2006
21,159
You express 0.9 as sum of binary fractions:

0.9 = (1/2) + (1/4) + (1/8) + ... to any level of precision you care to work with. In the above case you would have the binary fraction:

0.1110
 

Arbitrator

Joined Mar 10, 2011
16
would 19.9 in base 10 would be 0001 1001.1110 or 0001 1001.0111 in BCD?
__________________________<---------.---> __<---------.<-----
do you start from right and continue to go left?
 

justtrying

Joined Mar 9, 2011
439
You express 0.9 as sum of binary fractions:

0.9 = (1/2) + (1/4) + (1/8) + ... to any level of precision you care to work with. In the above case you would have the binary fraction:

0.1110
I believe this converts 0.9 into binary and not BCD.

I think 0.9 in BCD will simply be 0.1001 as the whole point of BCD is to use 0-9 binary representations of numbers to avoid these conversions. Forgive in advance if I am wrong. (as per Wiki. 0.2 = 0.0010)
 

Arbitrator

Joined Mar 10, 2011
16
so .8 will be 0.1000 or 0001 in BCD?
for .9 in Binary i am getting .11100

since 1/2 + 1/4 + 1/8 is ALMOST .9

but i am unsure about BCD is 0.8, 0.1000 or 0.0001?? i am sure it is one or the other.
 
Last edited:

Arbitrator

Joined Mar 10, 2011
16
hmm.. so your saying 8 = 1000 in BCD, i agree. so .8 must be .1000... i guess. so your saying that for BCD .x is read in whole numbers and only binary is read by 1/2+1/4+1/8 excetera?
therefore .8 = 1000 in BCD and .8 = 1100 -approximately (it is actually 7.5), is that what you mean?
 
Last edited:

justtrying

Joined Mar 9, 2011
439
I assume .8 = 1100 (~0.75) in binary...

and you are right about it being read as whole numbers since the purpose of BCD is to take each digit in the number and represent it in binary form using 4 bits of data.
 
Top