Binary multiplication for negative and positive numbers
Answers
Answered by
0
The question is about binary multiplication for negative numbers. Assume we want to multiply -5 * -3 so the result is +15.
1) In the first step, we have to use 2's complement for the inputs.
+5 = 0101 -> -5 = 1011 +3 = 0011 -> -3 = 1101
2) We follow the simple pencil-and-paper method and we have to note the sign extension. For the sake of clarity I put the signs extensions in []
1011 * 1101 ---------------- [1] [1] [1] 1 0 1 1 [0] [0] 0 0 0 0 [1] 1 0 1 1 1 0 1 1 + ------------------------------ c7 c6 c5 c4 c3 c2 c1
3) summing the columns show that
c1 = 1 + 0 + 0 + 0 = 1 c2 = 1 + 0 + 0 + 0 = 1 c3 = 0 + 0 + 1 + 0 = 1 c4 = 1 + 0 + 1 + 1 = 1 (carry 1 to c5) c5 = 1(carry) + 1(sign) + 0 + 0 + 1 = 1 (carry 1 to c6) c6 = 1(carry) + 1(sign) + 0(sign) + 1 + 0 = 1 (carry 1 to c7) c7 = 1(carry) + 1(sign) + 0(sign) + 1(sign) + 1 = ???
Actually c7 = 100 but we have to represent only one digit in c7. So does that mean
c7 = 0 (carry 10)
?? Usually the final carry bit is only one digit. More than that, the final number is not equal to +15.
1) In the first step, we have to use 2's complement for the inputs.
+5 = 0101 -> -5 = 1011 +3 = 0011 -> -3 = 1101
2) We follow the simple pencil-and-paper method and we have to note the sign extension. For the sake of clarity I put the signs extensions in []
1011 * 1101 ---------------- [1] [1] [1] 1 0 1 1 [0] [0] 0 0 0 0 [1] 1 0 1 1 1 0 1 1 + ------------------------------ c7 c6 c5 c4 c3 c2 c1
3) summing the columns show that
c1 = 1 + 0 + 0 + 0 = 1 c2 = 1 + 0 + 0 + 0 = 1 c3 = 0 + 0 + 1 + 0 = 1 c4 = 1 + 0 + 1 + 1 = 1 (carry 1 to c5) c5 = 1(carry) + 1(sign) + 0 + 0 + 1 = 1 (carry 1 to c6) c6 = 1(carry) + 1(sign) + 0(sign) + 1 + 0 = 1 (carry 1 to c7) c7 = 1(carry) + 1(sign) + 0(sign) + 1(sign) + 1 = ???
Actually c7 = 100 but we have to represent only one digit in c7. So does that mean
c7 = 0 (carry 10)
?? Usually the final carry bit is only one digit. More than that, the final number is not equal to +15.
Similar questions
English,
8 months ago
Math,
1 year ago
Biology,
1 year ago
Political Science,
1 year ago
English,
1 year ago