crammy90
Member
- Joined
- Mar 26, 2006
- Messages
- 264
- Gender
- Male
- HSC
- 2008
when we are asked to multiply 2 2's compliment numbers do we just do its outright because a number expresed in 2's compliment is equal it what it is not in 2's comp
so say we had to multiply the 4-bit number of -5 decimal with -2 decimal
5(dec) = 0101(base 2)
= 1011(2's comp) so this is -5
2(dec) = 0010(base 2)
= 1110(2's comp) so this is -2
(multiplying these 2's comp)
= 10011010 = 154(2's comp) hmm as its 4-bit do we take the first 4 bits
i.e. 1010 = 10(which would be in 2's comp)
= -102 (normal decimal)
EDITTED:::::after reading i have become aware that this number we are trying to achieve (-10) is outside the available 4-bit range of 2's comp (i.e. -3,4) so it has given us this stupid number.
lets do this calculation again in another range (lets say -15 to 16. 2^5 = 5bit will allow us to do this calculation).
again:
5(dec) = 00101(base 2)
= 11011(2's comp) so this is -5
2(dec) = 00010(base 2)
= 11110(2's comp) so this is -2
multiplying we get:
11011 x 11110 =
= 1100101010 = 810 (2's comp)
= -241 (normally)
what am i doing wrong lol
what did i do wrong?
confused
ALSO::
subtraction we find 2's comp of number being subracted and add to other number.
"If the number being subtracted is negative the leading bit is 0. We find the twos comp of this which will be positive and add"
WTF
i thought we were using 2's comp to express neg numbers. IF the number we are subtracting is a negative with a 1 doesnt that mean its a 2's compliment of a positive number?
and if the number being subtracted is a negative which we can derive from the leading bit being a 1 giving it a negative weighting, what form is the number in. If this number is just in regular 8 bit binary and the leading bit is a 1 doesnt this just represent 256 for that number?
so say we had to multiply the 4-bit number of -5 decimal with -2 decimal
5(dec) = 0101(base 2)
= 1011(2's comp) so this is -5
2(dec) = 0010(base 2)
= 1110(2's comp) so this is -2
(multiplying these 2's comp)
= 10011010 = 154(2's comp) hmm as its 4-bit do we take the first 4 bits
i.e. 1010 = 10(which would be in 2's comp)
= -102 (normal decimal)
EDITTED:::::after reading i have become aware that this number we are trying to achieve (-10) is outside the available 4-bit range of 2's comp (i.e. -3,4) so it has given us this stupid number.
lets do this calculation again in another range (lets say -15 to 16. 2^5 = 5bit will allow us to do this calculation).
again:
5(dec) = 00101(base 2)
= 11011(2's comp) so this is -5
2(dec) = 00010(base 2)
= 11110(2's comp) so this is -2
multiplying we get:
11011 x 11110 =
= 1100101010 = 810 (2's comp)
= -241 (normally)
what am i doing wrong lol
what did i do wrong?
confused
ALSO::
subtraction we find 2's comp of number being subracted and add to other number.
"If the number being subtracted is negative the leading bit is 0. We find the twos comp of this which will be positive and add"
WTF
i thought we were using 2's comp to express neg numbers. IF the number we are subtracting is a negative with a 1 doesnt that mean its a 2's compliment of a positive number?
and if the number being subtracted is a negative which we can derive from the leading bit being a 1 giving it a negative weighting, what form is the number in. If this number is just in regular 8 bit binary and the leading bit is a 1 doesnt this just represent 256 for that number?
Last edited: