Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Wow, yet another probably wrong responce by me, oh well, i have nothing better to do right now.
Anyways, if you convert that binary to decimal you'd get 7 - 12, which comes out to negative 5... Now i'm not really sure on how you do negative numbers in binary...
But,well i guess it would be -101

if my memory serves me right this is how it is done:
0111 = 00000111 (7)
- 1100 = 00001100 (12)first do it the other way around as in an 8 bit format:
00001100
- 00000111
----------
00000101Using Signed Magnitude:
just put 1 instead of 0 on the left most digit(bit), this digit indicates if its a positive (0) or a negative (1) number.10000101 = -5
-or-
Using One's Complement:
flip the digits: convert 0's to 1's and 1's to 0's00000101 = 11111010
-or-
Using Two's Complement:
use the number in One's compliment then add 1 to it:
11111010
+ 1
----------
11111011im sure of the signed magnitude but you have to check with a teacher or someone who knows alot more on binary numbers about the One's and Two's Complement answers.
hope this helps. :)

0111-1100= 7-12, which equals -5.
5=0101
-5=-101with 4 bits:
-5=1101 in Signed magnitude
-5=1010 in one's complement
-5=1011 in two's complement.So I guess I got the same answers BelAnWel got...Must be right!
-SN

Sure, in numeric sense it is ok. What data type are we representing though? The smallest processor representation is an unsigned byte. With compilers it could be signed or unsigned. We are shown only 4 bits however and that kind of throws things around a little or am I getting too semantic?
borelli34

0111
-1100
-----
-5Step one: take 2's complement of 1100 = 12
1100 --> 1's compliment --> 0011
0011 + 1 --> 2's compliment --> 0100
- this is what you needStep two: 0111 + 0100 = 1011 yes now you ADD
the answer is 1011 which is -5 in signed magnitude.
if you don't belive me perform 2's compliment on the answer: 1011
1's compliment -> 1011 -> 0100
2's compliment -> 0100 + 1 -> 0101 = 5.the ONE in "1"011 represents the negative sign.

My answer assumed that the numbers were only numbers, without any data type, or processor associated with them, and that they were 4 bit unsigned numbers (ie 1100=12 and not -4, -8, or -3.) I did the math as a human would, not as a computer would. If this is for a computer program, however, then John is right...you need to know what size the numbers are if you don't already, and that size will change the answers. Thanks for the clarification John.
-SN

i just looks like the kid wants some help with his homework. lets not scare him will all the technical background of the subject. although it all makes sense, though. :)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |