Solving Binary Math Problems: Is it Correct?

  • Thread starter naspek
  • Start date
  • Tags
    Binary
In summary, the conversation discusses interpreting numbers in two's complement form and verifying the accuracy of the sum of two numbers. Through the use of binary numbers and their corresponding decimal values, the correct interpretations of the given numbers are identified and the sum is verified to be accurate. The conversation also highlights the importance of careful addition when working with signed numbers.
  • #1
naspek
181
0

Homework Statement


http://img593.imageshack.us/img593/3376/76384308.jpg


The Attempt at a Solution


i've got no problem with question a)
but..

i've got couple of question in question b)

my solution is.. 0111 + 1011 = 1 0010
is it correct?

how am i going to verify it in decimal..?
is it -1 + 5 = 4 ?
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
You're misinterpreting the problem. It's not asking you to find the two's complement of the given numbers; it wants you to interpret them as representing numbers in two's complement form. So 1001 will correspond to some negative number (it's not -1) and 0101 to some positive number. When you add them, you'll get another number that you should again interpret as the two's complement representation of some number. The problem wants you to verify that you indeed get the right answer.
 
  • #3
vela said:
You're misinterpreting the problem. It's not asking you to find the two's complement of the given numbers; it wants you to interpret them as representing numbers in two's complement form. So 1001 will correspond to some negative number (it's not -1) and 0101 to some positive number. When you add them, you'll get another number that you should again interpret as the two's complement representation of some number. The problem wants you to verify that you indeed get the right answer.

hurmm.. kinda blur.. thanks for ur clarification..
ok.. here what i should do..

add them up.. i got the same answer as part a)...
which is 1110..
should i apply 2's complement on that number (1110)?

if I'm going to verify it using decimal..
i still got the same answer as part a).. right? :confused:
 
  • #4
naspek said:
hurmm.. kinda blur.. thanks for ur clarification..
ok.. here what i should do..

add them up.. i got the same answer as part a)...
which is 1110..
should i apply 2's complement on that number (1110)?
No, you're supposed to interpret that number as already being in twos' complement form. Since the high bit is 1, it's a negative number. What's the number?
naspek said:
if I'm going to verify it using decimal..
i still got the same answer as part a).. right? :confused:
 
  • #5
1. What is the two's complement interpretation of 1001?
2. What is the two's complement interpretation of 0101?
3. What is the two's complement interpretation of their sum, 1110?

Note I'm not asking you to find the two's complement of any of these four-bit numbers. I'm asking you what decimal number do they represent when interpreted as a number in two's complement form.

You may find this Wiki article helpful:

http://en.wikipedia.org/wiki/Sign_and_magnitude#Two.27s_complement
 
  • #6
vela said:
1. What is the two's complement interpretation of 1001?
2. What is the two's complement interpretation of 0101?
3. What is the two's complement interpretation of their sum, 1110?

Note I'm not asking you to find the two's complement of any of these four-bit numbers. I'm asking you what decimal number do they represent when interpreted as a number in two's complement form.

You may find this Wiki article helpful:

http://en.wikipedia.org/wiki/Sign_and_magnitude#Two.27s_complement

1. What is the two's complement interpretation of 1001?
is it 1001 represent -1 in decimal?

2. What is the two's complement interpretation of 0101?
is it 0101 represent +5 in decimal?

3. What is the two's complement interpretation of their sum, 1110?
is it 1110 represent -6?

but.. it seems not correct..
 
  • #7
Mark44 said:
No, you're supposed to interpret that number as already being in twos' complement form. Since the high bit is 1, it's a negative number. What's the number?

so.. 1110 = -6?
 
  • #8
Your answer for 1. is incorrect and thus your answer for 3. is also incorrect. Can you show your working for 1. 2. and 3. in converting the binary number to decimal?
 
  • #9
Zryn said:
Your answer for 1. is incorrect and thus your answer for 3. is also incorrect. Can you show your working for 1. 2. and 3. in converting the binary number to decimal?

2^3 , 2^2, 2^1, 2^0

so.. in 2's complement number..
left most bit 1111 is the sign for the binary number given right?

so.. when 1001 will equal to.. -1 x (2^0) = -1
is it correct?
 
  • #10
Ahh, now I see.

Indeed the MSB (Most Significant Bit - the left most one) is the sign, however it still retains its value. For example:

1000 0000 = -1 * (2^7) = -128
1001 0001 = -1 * (2^7) + 1 * (2^4) + 1 * (2^0) = -128 + 16 + 1 = -111
1111 1111 = -1 * (2^7) + ... + 1 * (2^0) = -128 + ... + 1 = -1
 
  • #11
Zryn said:
Ahh, now I see.

Indeed the MSB (Most Significant Bit - the left most one) is the sign, however it still retains its value. For example:

1000 0000 = -1 * (2^7) = -128
1001 0001 = -1 * (2^7) + 1 * (2^4) + 1 * (2^0) = -128 + 16 + 1 = -111
1111 1111 = -1 * (2^7) + ... + 1 * (2^0) = -128 + ... + 1 = -1

fuuhhh~~ now i understand it.. Thanks Zryn!

ok.. so..

1. What is the two's complement interpretation of 1001?
1001 = -9

2. What is the two's complement interpretation of 0101?
0101 still equal to +5 as my answer before..

3. What is the two's complement interpretation of their sum, 1110?
1110 = -14..

but.. how come -9 + 5 = -14?
it should be -4 right?
 
  • #12
You're closer, but 1. is still wrong, and 3. is wrong for the same reason.

When does -9 + 5 = -14?

And no, it should not be -4 :)

*Hint: Write the equivalent decimal numbers for each bit when you add the signed MSB to the LSB of 1001, what decimal number does each one represent, and what do they sum to? Next, assuming your binary addition is correct and the result is in fact 1110, go through the equivalent decimal number for each bit and then add them together and post what you get (i.e. the format for my previous 3 examples for the 8- bit signed numbers, so each and every calculation is written out in full)
 
Last edited:
  • #13
Zryn said:
You're closer, but 1. is still wrong, and 3. is wrong for the same reason.

When does -9 + 5 = -14?

And no, it should not be -4 :)

ok2! i got it..!

1001 = [-1 x (2^3)] + [1 x (2^0)]
...= -7
correct?

so..
2nd question still correct..

3rd question...

1110 = [-1 * 2^3] + [1 * 2^2] + [1 * 2^1]
...= -8 + 4 + 2
...= -2
correct ?
 
  • #14
Yep, spot on!

It was just some wonky addition (-8 + 1 = -9) that was throwing you off.
 
  • #15
Zryn said:
Yep, spot on!

It was just some wonky addition (-8 + 1 = -9) that was throwing you off.

geez! thank u very much guys! =)
 

1. How do I know if my solution to a binary math problem is correct?

To determine if your solution to a binary math problem is correct, you can check your answer by converting it back to decimal form and comparing it to the original problem. You can also use an online binary calculator or ask a peer or teacher to check your work.

2. What are some common mistakes to avoid when solving binary math problems?

Some common mistakes to avoid when solving binary math problems include forgetting to carry over numbers when adding or subtracting, not properly aligning numbers when performing operations, and misplacing or forgetting binary digits.

3. Can I use a calculator to solve binary math problems?

Yes, you can use a calculator to solve binary math problems. However, it is important to make sure the calculator is set to binary mode and that you understand how to properly input binary numbers and perform operations.

4. Are there any helpful tips for solving binary math problems?

Some helpful tips for solving binary math problems include breaking down larger numbers into smaller chunks, double checking your work, and practicing converting between decimal and binary numbers.

5. How can I improve my skills in solving binary math problems?

To improve your skills in solving binary math problems, you can practice regularly, seek help from a teacher or tutor, and use online resources and practice problems to familiarize yourself with different types of binary operations and conversions.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
4K
Back
Top