473,889 Members | 1,679 Online

# 1's complement and 2's complement

Hi all,
I have a few doubts in the 1's and 2's complement
representation. Generally negative numbers can be represented using
either 1's complement or 2's complement representation.

1's complement ---reverse all the bits
2's complement ---reverse all the bits + 1

i.e 1's complement of 2 ( 0000 0010 ) is -2 ( 1111 1101 )
But when a number and its complement are added the result must be a
zero right ??
But in this case 0000 0010 + 1111 1101 = 1111 1111 ==[ ?? ]
Should'nt we be getting a zero as result ???

2's complement of 2 ( 0000 0010 ) is -2 ( 1111 1110 )
Adding we get , 0000 0010 + 1111 1110 = 0000 0000 ==[ OK]

Does this complement representation have anything to do with the C's ~
[1's complement] operator ?
Is this representation architecture dependent or compiler dependent ?

Regards,
Sarathy

Aug 1 '06
20 45563

Roy Smith wrote:
That being said, I haven't seen a 1's complement
machine in a couple of eons. It's pretty much an obsolete concept as far
as hardware design goes.
Except of course as part of the format for IEEE floating point numbers
(float, double etc.).

K

Aug 1 '06 #11

Roy Smith wrote:
It's pretty much an obsolete concept as far as hardware design goes.

Not quite, many DSP-oriented CPU's use 1's complement arithmetic.

The advantage is, in a chain calculation, the negates and carries can
be computed separately and andded back at the end. With two's
complement the "add one" has to be done on each negate.

Aug 1 '06 #12
"Kirit Sælensminde" <ki************ ****@gmail.comw rites:
Roy Smith wrote:
>That being said, I haven't seen a 1's complement
machine in a couple of eons. It's pretty much an obsolete concept as far
as hardware design goes.

Except of course as part of the format for IEEE floating point numbers
(float, double etc.).

Actually, I think it's sign-and-magnitude, not one's-complement.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Aug 1 '06 #13
In article <11************ **********@m79g 2000cwm.googleg roups.com"=?iso-8859-1?q?Kirit_S=E6l ensminde?=" <ki************ ****@gmail.comw rites:
>
Roy Smith wrote:
That being said, I haven't seen a 1's complement
machine in a couple of eons. It's pretty much an obsolete concept as far
as hardware design goes.

Except of course as part of the format for IEEE floating point numbers
(float, double etc.).

I would not trust a book by an author who does not know the difference
between 1-s complement and sign-magnitude. The last machine I had
access to that used 1-s complement was the CDC Cyber 750, and the
successor in 750 mode (both for int and for float).
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Aug 1 '06 #14

Frederick Gotham wrote:
sarathy posted:
Please verify and revert back in case.

*Cringe*

I'd love to bludgeon to death the next person I hear utter that phrase.
I've never come across it before; what does it mean? Am I allowed to
revert to any previous condition, or is a particular one implied?

Aug 1 '06 #15
Dik T. Winter wrote:
In article <11************ **********@m79g 2000cwm.googleg roups.com"=?iso-8859-1?q?Kirit_S=E6l ensminde?=" <ki************ ****@gmail.comw rites:
>
Roy Smith wrote:
That being said, I haven't seen a 1's complement
machine in a couple of eons. It's pretty much an obsolete concept as far
as hardware design goes.
>
Except of course as part of the format for IEEE floating point numbers
(float, double etc.).
>

I would not trust a book by an author who does not know the difference
between 1-s complement and sign-magnitude. The last machine I had
access to that used 1-s complement was the CDC Cyber 750, and the
successor in 750 mode (both for int and for float).
Nobody doubts there were 1's complement iron, but when? The last CDC
machine I saw was the 160A in 1962 and I have no idea of its arithmetic
mode. In 1963 I learned the Philco 212/2000 system which was 2's
complement. Every machine I've seen since then is 2's complement for
integer arithmetic. That's 43 years. But I haven't seen them all.

What was the last 1's complement machine and when was it last produced?

I have never seen 'signed magnitude' integers on any machine.

Of course, IEEE floating point is signed magnitude. FP is not the issue.

--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Aug 2 '06 #16

Keith Thompson wrote:
Actually, I think it's sign-and-magnitude, not one's-complement.
Whoops. Fair enough.
K

Aug 2 '06 #17
In article <x9************ *************** ***@comcast.com >,
Joe Wright <jo********@com cast.netwrote:
What was the last 1's complement machine and when was it last produced?
Wikipedia (http://en.wikipedia.org/wiki/One%27s_complement) claims "the
PDP-1 and UNIVAC 1100/2200 series, among many others, used one's-complement
arithmetic."
Aug 2 '06 #18
"J. J. Farrell" <jj*@bcs.org.uk wrote:
Frederick Gotham wrote:
sarathy posted:
Please verify and revert back in case.
*Cringe*

I'd love to bludgeon to death the next person I hear utter that phrase.

I've never come across it before; what does it mean?
It's managementspeak . The presence of any meaning is purely optional.

Richard
Aug 2 '06 #19
rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
"J. J. Farrell" <jj*@bcs.org.uk wrote:
>Frederick Gotham wrote:
sarathy posted:
Please verify and revert back in case.

*Cringe*

I'd love to bludgeon to death the next person I hear utter that phrase.

I've never come across it before; what does it mean?

It's managementspeak . The presence of any meaning is purely optional.
Most managers would be smart enough to use the word "report" rather
than "revert".

Apart from that, sarathy did give the impression that he was ordering
us around. That probably wasn't his intent. The difference in
wording between a polite request and a politely-phrased order to an
underling can be subtle.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Aug 2 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.