Question: 3 . ( 2 0 points ) Recall from class that BCD stands for Binary Coded Decimal. It is a representation of decimal integers by
points
Recall from class that BCD stands for Binary Coded Decimal. It is a representation of decimal integers by encoding each digit with a bit string. In some more advanced calculating devices, the calculations are done in binary and then they are converted to BCD in order to print the result in decimal. There is an algorithm called Double Dabble that converts binary into BCD Here is a summary of the algorithm and an example:
You first initialize your binary number to the right of a divider.
Shift the number to the left one bit at a time, filling in bit registers.
If at any point in the shifting, the number in one of the bit registers is greater than or equal to add three to that register, then continue.
Terminate when the entire binary number has been shifted to the left of the divider.
Consider the example with the initial binary number: :
Initialize
Shift
Shift
Since we add
Shift.
Shift..
O
Since we add
Shift.
Since we add
Since we add
Shift.
Shift.
Shift.
Since we add
Shift. Terminate.
a points Perform this algorithm on the binary number:
b points If a straight binary number n is bits long, what is the maximum number of bits required for the BCD representation of n
c points Why do you add Hint: every time you shift to the left, you essentially double the integer to the left of the divider. What is the result of adding then doubling?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
