Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

1's and 2's complements of binary numbers

Status
Not open for further replies.

PG1995

Full Member level 5
Joined
Apr 18, 2011
Messages
248
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,758
Hi

Most computers (I'm not sure if all) do most of the arithmetic using addition operation - i.e. subtraction, multiplication, and division all use addition operation. This makes circuit design simple and with only one circuit you get to do different things.

What I guess 1's and 2's complements let us do all operations, subtraction, division, and multiplication using addition method.

complement (noun)
2 c : a number that when added to another number of the same sign yields zero if the significant digit farthest to the left is discarded —used especially in assembly language programming
[M-W's Col. Dic.]


In base 10 the compliment of 3 would be 7 because 3+7 = 10 and after discarding the 1, we are left with 0

Thus 4 is the compliment of 6, and 8 of 2, etc.

The compliment of 55 would be 45, because 55+45=100 and removing the 1 leaves you with 0 again.

With binary, the compliment of 1 is 1 because 1+1 =10

The compliment of 1010 would be 0110 (which is 2's complement of 1010) because 1010 + 0110 = 10000 in binary.

1: Let's say we have a binary number 110 (6). It's 1's complement would be: 001 (1), and 2's complement would be: 010 (2). I don't see what 1's and 2's complements of the number tells us. Please help me with it.

2: Perhaps, using a particular example could help us a bit. We have binary number 1010 (10) and we want to subtract 110 (6) from it - i.e. 1010 - 110. In base 10 arithmetic it would be 10 - 6 = 4. So, how do complements help us here?

1's complement of 110 = 001 (1)
2's complement of 110 = 010 (2)

I do have more related queries on this topic but I would ask them after clearing this up. Thanks.

Scanned pages which can be useful:
1: **broken link removed**
2: https://img836.imageshack.us/img836/2465/floyddigitalfundamental.jpg
 

The "compliment" comes from the usage of splitting the binary range to give you a complimenting pair of positive and negative values around zero. The MSB being a "1" indicates a negative value, when the binary value is viewed as a signed number.

Code:
Binary  Unsigned
111      7
110      6
101      5
100      4
011      3
010      2
001      1
000      0

Binary  Signed
011      3
010      2
001      1
000      0
111     -1
110     -2
101     -3
100     -4

Wikipedia has a BIG write-up on the usage and mathematical rationale behind two's compliment (and one's compliment, since it's buried in the two's compliment process).
Two's complement - Wikipedia, the free encyclopedia
 
  • Like
Reactions: PG1995

    PG1995

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top