3
$\begingroup$

I am new to Binary and we are learning it for my computer hardware class. Since I am just learning, I am not very sure how to represent negative numbers in binary.

I believe they are Signed magnitude, ones complement, and two's complement, but I need an example. I'm not really sure how to show how this is done exactly.

$\endgroup$
1
  • 2
    $\begingroup$ Have you looked at Wikipedia? There are examples there and a separate page for each of the three. $\endgroup$ Sep 29 '15 at 2:49
3
$\begingroup$

There's no shame in representing decimal -2 as binary -10. In computer science there are different ways to represent negative numbers.

Sometimes, in a method called one's compliment, in order to take the negative number you need to flip all of the bits; for example, 101 negated would be 010.

In a method called two's compliment, you start from the right, find the first '1', and invert all of the bits to the left of that '1': 101001000 negated would be 010111000

https://en.wikipedia.org/wiki/Signed_number_representations

Anyway, it really just depends on how you want to represent it.

$\endgroup$
2
  • 2
    $\begingroup$ Have you no shame, sir? $\endgroup$ Sep 29 '15 at 3:00
  • $\begingroup$ Thank you, I understand it now. $\endgroup$
    – VNrutgib
    Sep 29 '15 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.