
February 7th, 2007, 11:49 PM
#1
One's Complement/Two's complement
ok, so I'm trying to understand one's complement and two's complement, but I feel like I'm missing something. I understand that to get the negative value in one's complement you flip the bits and in two's complement you flip the bits and add one. Is addition the same using both one's and two's complement?
Also, I have practice questions for one of my classes and I'm a little confused by how they are presented. The question simply says to do the arithmetic in either 2's complement or 1's complement and to indicate if overflow or underflow occurs, yet none of the questions indicate whether you are meant to by adding or subtraction. Here's one of the examples:
01101000
10001100

February 8th, 2007, 04:15 PM
#2
Re: One's Complement/Two's complement
Originally Posted by daydreamerz
ok, so I'm trying to understand one's complement and two's complement, but I feel like I'm missing something. I understand that to get the negative value in one's complement you flip the bits and in two's complement you flip the bits and add one. Is addition the same using both one's and two's complement?
No. Adding using the one's compliment doesn't really mean anything, right? What happens if you add 00101 to 11010? You get 11111! However, if you add the two's compliment of a number to another number, you are actually performing a subtraction (i.e. adding a number to a negative number, same as subtracting two numbers).
Originally Posted by daydreamerz
Also, I have practice questions for one of my classes and I'm a little confused by how they are presented. The question simply says to do the arithmetic in either 2's complement or 1's complement and to indicate if overflow or underflow occurs, yet none of the questions indicate whether you are meant to by adding or subtraction. Here's one of the examples:
01101000
10001100
I would ask for clarification.
Viggy

February 8th, 2007, 04:48 PM
#3
Re: One's Complement/Two's complement
Adding using the one's compliment doesn't really mean anything, right?
Actually it does. Fortunately 1's complement is rarely found in Software Systems. It is found (although much less than 2030 years ago) in hardware systems.
The interesting "quirk" of 1's comp, is that there are two valid representations of "0" 0000000 and 1111111.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first

February 24th, 2009, 04:47 PM
#4
Re: One's Complement/Two's complement
hi everybody
i have 2 quistions:
.first:why 1's complement and 2's complement are called by this names
.second:i understand the 2's complement that if we represent the integer in 8bits so we will have 8 positive number each of the will map to a number some of them
are positive(2^n1)1
and others are negative (2^n1) and only one number will map to zero
so what is different in concept in 1's coplement , and 9's complement i cant understan its idea
and why in this (1's and 9's )there are tow representation of zero
thanks in advance

February 24th, 2009, 10:06 PM
#5
Re: One's Complement/Two's complement
Base1 Complement (1s complement for binary and 9s complement for decimal) are simple reflections.
Base Complement (2s complement for binary), is such that when you ADD the positive representation of a value you get all zeros.
Thus the former is easier to implement in hardware (anyone remember a 7404 ), but the latter is much more useful in computations.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
This a Codeguru.com survey!
