Computing.Net > Forums > Programming > Binary substraction help!!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Binary substraction help!!

Reply to Message Icon

Name: KitKat
Date: January 22, 2003 at 16:45:40 Pacific
OS: xp
CPU/Ram: n/a
Comment:

can somebody help me substracting these two binary numbers please?

0111-1100



Sponsored Link
Ads by Google

Response Number 1
Name: Someone
Date: January 22, 2003 at 18:33:28 Pacific
Reply:

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


0

Response Number 2
Name: BelAnWel
Date: January 22, 2003 at 19:39:55 Pacific
Reply:

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
----------
00000101

Using 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's

00000101 = 11111010

-or-
Using Two's Complement:
use the number in One's compliment then add 1 to it:
11111010
+ 1
----------
11111011

im 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. :)


0

Response Number 3
Name: SN
Date: January 22, 2003 at 20:19:05 Pacific
Reply:

0111-1100= 7-12, which equals -5.
5=0101
-5=-101

with 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


0

Response Number 4
Name: borelli34
Date: January 24, 2003 at 12:52:30 Pacific
Reply:

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


0

Response Number 5
Name: Clicker
Date: January 24, 2003 at 13:29:53 Pacific
Reply:

0111
-1100
-----
-5

Step one: take 2's complement of 1100 = 12
1100 --> 1's compliment --> 0011
0011 + 1 --> 2's compliment --> 0100
- this is what you need

Step 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.


0

Related Posts

See More



Response Number 6
Name: SN
Date: January 24, 2003 at 13:33:42 Pacific
Reply:

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


0

Response Number 7
Name: BelAnWel
Date: January 24, 2003 at 17:23:21 Pacific
Reply:

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. :)


0

Response Number 8
Name: KitKat
Date: January 25, 2003 at 17:21:56 Pacific
Reply:

Thanks for your help gentlemen. good notice BelAnWel.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Binary substraction help!!

decimal to binary conversion help!! www.computing.net/answers/programming/decimal-to-binary-conversion-help/4822.html

dec to binary conversion help www.computing.net/answers/programming/dec-to-binary-conversion-help/19802.html

python idle version # ? www.computing.net/answers/programming/python-idle-version-/2928.html