<s>
In	O
computing	O
,	O
signed	B-Algorithm
number	I-Algorithm
representations	I-Algorithm
are	O
required	O
to	O
encode	O
negative	O
numbers	O
in	O
binary	O
number	O
systems	O
.	O
</s>
<s>
However	O
,	O
in	O
RAM	B-Architecture
or	O
CPU	B-General_Concept
registers	I-General_Concept
,	O
numbers	O
are	O
represented	O
only	O
as	O
sequences	O
of	O
bits	O
,	O
without	O
extra	O
symbols	O
.	O
</s>
<s>
The	O
four	O
best-known	O
methods	O
of	O
extending	O
the	O
binary	O
numeral	O
system	O
to	O
represent	O
signed	B-Algorithm
numbers	O
are	O
:	O
sign	O
–	O
magnitude	O
,	O
ones	O
 '	O
complement	O
,	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
,	O
and	O
offset	O
binary	O
.	O
</s>
<s>
For	O
integers	O
,	O
the	O
representation	O
used	O
in	O
most	O
current	O
computing	O
devices	O
is	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
,	O
although	O
the	O
Unisys	B-Device
ClearPath	I-Device
Dorado	I-Device
series	I-Device
mainframes	O
use	O
ones	O
 '	O
complement	O
.	O
</s>
<s>
One	O
camp	O
supported	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
,	O
the	O
system	O
that	O
is	O
dominant	O
today	O
.	O
</s>
<s>
Sign	O
–	O
magnitude	O
allowed	O
for	O
easier	O
tracing	O
of	O
memory	O
dumps	O
(	O
a	O
common	O
process	O
in	O
the	O
1960s	O
)	O
as	O
small	O
numeric	B-Algorithm
values	O
use	O
fewer	O
1	O
bits	O
.	O
</s>
<s>
IBM	O
was	O
one	O
of	O
the	O
early	O
supporters	O
of	O
sign	O
–	O
magnitude	O
,	O
with	O
their	O
704	B-Device
,	O
709	B-Device
and	O
709x	B-Device
series	O
computers	O
being	O
perhaps	O
the	O
best-known	O
systems	O
to	O
use	O
it	O
.	O
</s>
<s>
But	O
it	O
also	O
shared	O
an	O
undesirable	O
characteristic	O
with	O
sign	O
–	O
magnitude	O
:	O
the	O
ability	O
to	O
represent	O
negative	B-Algorithm
zero	I-Algorithm
( −0	O
)	O
.	O
</s>
<s>
Negative	B-Algorithm
zero	I-Algorithm
behaves	O
exactly	O
like	O
positive	O
zero	O
:	O
when	O
used	O
as	O
an	O
operand	O
in	O
any	O
calculation	O
,	O
the	O
result	O
will	O
be	O
the	O
same	O
whether	O
an	O
operand	O
is	O
positive	O
or	O
negative	B-Algorithm
zero	I-Algorithm
.	O
</s>
<s>
The	O
PDP-1	B-Device
,	O
CDC	B-Device
160	I-Device
series	I-Device
,	O
CDC	B-Device
3000	I-Device
series	I-Device
,	O
CDC	B-Device
6000	I-Device
series	I-Device
,	O
UNIVAC	O
1100	O
series	O
,	O
and	O
LINC	B-Device
computer	O
use	O
ones	O
 '	O
complement	O
representation	O
.	O
</s>
<s>
Two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
is	O
the	O
easiest	O
to	O
implement	O
in	O
hardware	O
,	O
which	O
may	O
be	O
the	O
ultimate	O
reason	O
for	O
its	O
widespread	O
popularity	O
.	O
</s>
<s>
Mainframes	O
such	O
as	O
the	O
IBM	B-Application
System/360	I-Application
,	O
the	O
GE-600	B-Device
series	I-Device
,	O
and	O
the	O
PDP-6	B-Device
and	O
PDP-10	B-Device
use	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
,	O
as	O
did	O
minicomputers	O
such	O
as	O
the	O
PDP-5	B-Device
and	O
PDP-8	B-Device
and	O
the	O
PDP-11	B-Device
and	O
VAX	B-Device
machines	O
.	O
</s>
<s>
The	O
architects	O
of	O
the	O
early	O
integrated-circuit-based	O
CPUs	O
(	O
Intel	B-General_Concept
8080	I-General_Concept
,	O
etc	O
.	O
)	O
</s>
<s>
also	O
chose	O
to	O
use	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
math	O
.	O
</s>
<s>
As	O
IC	O
technology	O
advanced	O
,	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
technology	O
was	O
adopted	O
in	O
virtually	O
all	O
processors	O
,	O
including	O
x86	B-Operating_System
,	O
m68k	B-Device
,	O
Power	B-Architecture
ISA	I-Architecture
,	O
MIPS	B-Device
,	O
SPARC	B-Architecture
,	O
ARM	B-Architecture
,	O
Itanium	B-General_Concept
,	O
PA-RISC	B-Device
,	O
and	O
DEC	B-Device
Alpha	I-Device
.	O
</s>
<s>
In	O
the	O
sign	O
–	O
magnitude	O
representation	O
,	O
also	O
called	O
sign-and-magnitude	O
or	O
signed	B-Algorithm
magnitude	O
,	O
a	O
signed	B-Algorithm
number	O
is	O
represented	O
by	O
the	O
bit	O
pattern	O
corresponding	O
to	O
the	O
sign	O
of	O
the	O
number	O
for	O
the	O
sign	B-Algorithm
bit	I-Algorithm
(	O
often	O
the	O
most	O
significant	O
bit	O
,	O
set	O
to	O
0	O
for	O
a	O
positive	O
number	O
and	O
to	O
1	O
for	O
a	O
negative	O
number	O
)	O
,	O
and	O
the	O
magnitude	O
of	O
the	O
number	O
(	O
or	O
absolute	O
value	O
)	O
for	O
the	O
remaining	O
bits	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
an	O
eight-bit	O
byte	B-Application
,	O
only	O
seven	O
bits	O
represent	O
the	O
magnitude	O
,	O
which	O
can	O
range	O
from	O
0000000	O
(	O
0	O
)	O
to	O
1111111	O
(	O
127	O
)	O
.	O
</s>
<s>
Thus	O
numbers	O
ranging	O
from	O
−12710	O
to	O
+12710	O
can	O
be	O
represented	O
once	O
the	O
sign	B-Algorithm
bit	I-Algorithm
(	O
the	O
eighth	O
bit	O
)	O
is	O
added	O
.	O
</s>
<s>
For	O
example	O
,	O
−4310	O
encoded	O
in	O
an	O
eight-bit	O
byte	B-Application
is	O
10101011	O
while	O
4310	O
is	O
00101011	O
.	O
</s>
<s>
There	O
are	O
two	O
ways	O
to	O
represent	O
zero	O
,	O
00000000	O
(	O
0	O
)	O
and	O
10000000	O
( −0	O
)	O
.	O
</s>
<s>
Addition	O
and	O
subtraction	O
require	O
different	O
behavior	O
depending	O
on	O
the	O
sign	B-Algorithm
bit	I-Algorithm
,	O
whereas	O
one	O
's	O
complement	O
can	O
ignore	O
the	O
sign	B-Algorithm
bit	I-Algorithm
and	O
just	O
do	O
an	O
end-around	O
carry	B-Algorithm
,	O
and	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
can	O
ignore	O
the	O
sign	B-Algorithm
bit	I-Algorithm
and	O
depend	O
on	O
the	O
overflow	B-Error_Name
behavior	O
.	O
</s>
<s>
Comparison	O
also	O
requires	O
inspecting	O
the	O
sign	B-Algorithm
bit	I-Algorithm
,	O
whereas	O
in	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
,	O
one	O
can	O
simply	O
subtract	O
the	O
two	O
numbers	O
,	O
and	O
check	O
if	O
the	O
outcome	O
is	O
positive	O
or	O
negative	O
.	O
</s>
<s>
The	O
minimum	O
negative	O
number	O
is	O
−127	O
instead	O
of	O
−128	O
in	O
the	O
case	O
of	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
.	O
</s>
<s>
Some	O
early	O
binary	O
computers	O
(	O
e.g.	O
,	O
IBM	B-Device
7090	I-Device
)	O
use	O
this	O
representation	O
,	O
perhaps	O
because	O
of	O
its	O
natural	O
relation	O
to	O
common	O
usage	O
.	O
</s>
<s>
Sign	O
–	O
magnitude	O
is	O
the	O
most	O
common	O
way	O
of	O
representing	O
the	O
significand	B-Algorithm
in	O
floating-point	B-Algorithm
values	O
.	O
</s>
<s>
Like	O
sign	O
–	O
magnitude	O
representation	O
,	O
ones	O
 '	O
complement	O
has	O
two	O
representations	O
of	O
0	O
:	O
00000000	O
( +0	O
)	O
and	O
11111111	O
( −0	O
)	O
.	O
</s>
<s>
The	O
range	O
of	O
signed	B-Algorithm
numbers	O
using	O
ones	O
 '	O
complement	O
is	O
represented	O
by	O
to	O
and	O
±0	O
.	O
</s>
<s>
A	O
conventional	O
eight-bit	O
byte	B-Application
is	O
−12710	O
to	O
+12710	O
with	O
zero	O
being	O
either	O
00000000	O
( +0	O
)	O
or	O
11111111	O
( −0	O
)	O
.	O
</s>
<s>
To	O
add	O
two	O
numbers	O
represented	O
in	O
this	O
system	O
,	O
one	O
does	O
a	O
conventional	O
binary	O
addition	O
,	O
but	O
it	O
is	O
then	O
necessary	O
to	O
do	O
an	O
end-around	O
carry	B-Algorithm
:	O
that	O
is	O
,	O
add	O
any	O
resulting	O
carry	B-Algorithm
back	O
into	O
the	O
resulting	O
sum	O
.	O
</s>
<s>
The	O
correct	O
result	O
(	O
00000001	O
)	O
only	O
appears	O
when	O
the	O
carry	B-Algorithm
is	O
added	O
back	O
in	O
.	O
</s>
<s>
A	O
remark	O
on	O
terminology	O
:	O
The	O
system	O
is	O
referred	O
to	O
as	O
"	O
ones	O
 '	O
complement	O
"	O
because	O
the	O
negation	O
of	O
a	O
positive	O
value	O
x	O
(	O
represented	O
as	O
the	O
bitwise	O
NOT	O
of	O
x	O
)	O
can	O
also	O
be	O
formed	O
by	O
subtracting	O
x	O
from	O
the	O
ones	O
 '	O
complement	O
representation	O
of	O
zero	O
that	O
is	O
a	O
long	O
sequence	O
of	O
ones	O
( −0	O
)	O
.	O
</s>
<s>
Two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
arithmetic	I-General_Concept
,	O
on	O
the	O
other	O
hand	O
,	O
forms	O
the	O
negation	O
of	O
x	O
by	O
subtracting	O
x	O
from	O
a	O
single	O
large	O
power	O
of	O
two	O
that	O
is	O
congruent	O
to	O
+0	B-Algorithm
.	O
</s>
<s>
Therefore	O
,	O
ones	O
 '	O
complement	O
and	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
representations	O
of	O
the	O
same	O
negative	O
value	O
will	O
differ	O
by	O
one	O
.	O
</s>
<s>
In	O
the	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
representation	O
,	O
a	O
negative	O
number	O
is	O
represented	O
by	O
the	O
bit	O
pattern	O
corresponding	O
to	O
the	O
bitwise	O
NOT	O
(	O
i.e.	O
</s>
<s>
It	O
circumvents	O
the	O
problems	O
of	O
multiple	O
representations	O
of	O
0	O
and	O
the	O
need	O
for	O
the	O
end-around	O
carry	B-Algorithm
of	O
the	O
ones	O
 '	O
complement	O
representation	O
.	O
</s>
<s>
This	O
can	O
also	O
be	O
thought	O
of	O
as	O
the	O
most	O
significant	O
bit	O
representing	O
the	O
inverse	O
of	O
its	O
value	O
in	O
an	O
unsigned	B-Algorithm
integer	O
;	O
in	O
an	O
8-bit	O
unsigned	B-Algorithm
byte	B-Application
,	O
the	O
most	O
significant	O
bit	O
represents	O
the	O
128ths	O
place	O
,	O
where	O
in	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
that	O
bit	O
would	O
represent	O
−128	O
.	O
</s>
<s>
In	O
two's-complement	B-General_Concept
,	O
there	O
is	O
only	O
one	O
zero	O
,	O
represented	O
as	O
00000000	O
.	O
</s>
<s>
Addition	O
of	O
a	O
pair	O
of	O
two's-complement	B-General_Concept
integers	O
is	O
the	O
same	O
as	O
addition	O
of	O
a	O
pair	O
of	O
unsigned	B-Algorithm
numbers	I-Algorithm
(	O
except	O
for	O
detection	O
of	O
overflow	B-Error_Name
,	O
if	O
that	O
is	O
done	O
)	O
;	O
the	O
same	O
is	O
true	O
for	O
subtraction	O
and	O
even	O
for	O
N	O
lowest	O
significant	O
bits	O
of	O
a	O
product	O
(	O
value	O
of	O
multiplication	O
)	O
.	O
</s>
<s>
For	O
instance	O
,	O
a	O
two's-complement	B-General_Concept
addition	O
of	O
127	O
and	O
−128	O
gives	O
the	O
same	O
binary	O
bit	O
pattern	O
as	O
an	O
unsigned	B-Algorithm
addition	O
of	O
127	O
and	O
128	O
,	O
as	O
can	O
be	O
seen	O
from	O
the	O
8-bit	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
table	O
.	O
</s>
<s>
An	O
easier	O
method	O
to	O
get	O
the	O
negation	O
of	O
a	O
number	O
in	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
is	O
as	O
follows	O
:	O
</s>
<s>
Example	O
:	O
for	O
+2	O
,	O
which	O
is	O
00000010	O
in	O
binary	O
(	O
the	O
~	O
character	O
is	O
the	O
C	B-Language
bitwise	O
NOT	O
operator	O
,	O
so	O
~	O
X	O
means	O
"	O
invert	O
all	O
the	O
bits	O
in	O
X	O
"	O
)	O
:	O
</s>
<s>
In	O
the	O
offset	O
binary	O
representation	O
,	O
also	O
called	O
excess-K	O
or	O
biased	O
,	O
a	O
signed	B-Algorithm
number	O
is	O
represented	O
by	O
the	O
bit	O
pattern	O
corresponding	O
to	O
the	O
unsigned	B-Algorithm
number	I-Algorithm
plus	O
K	O
,	O
with	O
K	O
being	O
the	O
biasing	O
value	O
or	O
offset	O
.	O
</s>
<s>
This	O
can	O
be	O
seen	O
as	O
a	O
slight	O
modification	O
and	O
generalization	O
of	O
the	O
aforementioned	O
two's-complement	B-General_Concept
,	O
which	O
is	O
virtually	O
the	O
representation	O
with	O
negated	O
most	O
significant	O
bit	O
.	O
</s>
<s>
Biased	O
representations	O
are	O
now	O
primarily	O
used	O
for	O
the	O
exponent	O
of	O
floating-point	B-Algorithm
numbers	I-Algorithm
.	O
</s>
<s>
The	O
IEEE	O
754	O
floating-point	B-Algorithm
standard	O
defines	O
the	O
exponent	O
field	O
of	O
a	O
single-precision	O
(	O
32-bit	O
)	O
number	O
as	O
an	O
8-bit	O
excess-127	O
field	O
.	O
</s>
<s>
The	O
double-precision	O
(	O
64-bit	O
)	O
exponent	O
field	O
is	O
an	O
11-bit	O
excess-1023	O
field	O
;	O
see	O
exponent	B-Algorithm
bias	I-Algorithm
.	O
</s>
<s>
In	O
the	O
base	O
−2	O
representation	O
,	O
a	O
signed	B-Algorithm
number	O
is	O
represented	O
using	O
a	O
number	O
system	O
with	O
base	O
−2	O
.	O
</s>
<s>
Google	O
's	O
Protocol	B-Protocol
Buffers	I-Protocol
"	O
zig-zag	O
encoding	O
"	O
is	O
a	O
system	O
similar	O
to	O
sign	O
–	O
magnitude	O
,	O
but	O
uses	O
the	O
least	O
significant	O
bit	O
to	O
represent	O
the	O
sign	O
and	O
has	O
a	O
single	O
representation	O
of	O
zero	O
.	O
</s>
<s>
This	O
allows	O
a	O
variable-length	O
quantity	O
encoding	O
intended	O
for	O
nonnegative	O
(	O
unsigned	B-Algorithm
)	O
integers	O
to	O
be	O
used	O
efficiently	O
for	O
signed	B-Algorithm
integers	O
.	O
</s>
<s>
A	O
similar	O
method	O
is	O
used	O
in	O
the	O
Advanced	B-Application
Video	I-Application
Coding/H.264	I-Application
and	O
High	B-Algorithm
Efficiency	I-Algorithm
Video	I-Algorithm
Coding/H.265	I-Algorithm
video	O
compression	O
standards	O
to	O
extend	O
exponential-Golomb	O
coding	O
to	O
negative	O
numbers	O
.	O
</s>
<s>
In	O
that	O
extension	O
,	O
the	O
least	O
significant	O
bit	O
is	O
almost	O
a	O
sign	B-Algorithm
bit	I-Algorithm
;	O
zero	O
has	O
the	O
same	O
least	O
significant	O
bit	O
(	O
0	O
)	O
as	O
all	O
the	O
negative	O
numbers	O
.	O
</s>
<s>
This	O
choice	O
results	O
in	O
the	O
largest	O
magnitude	O
representable	O
positive	O
number	O
being	O
one	O
higher	O
than	O
the	O
largest	O
magnitude	O
negative	O
number	O
,	O
unlike	O
in	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
or	O
the	O
Protocol	B-Protocol
Buffers	I-Protocol
zig-zag	O
encoding	O
.	O
</s>
<s>
Another	O
approach	O
is	O
to	O
give	O
each	O
digit	O
a	O
sign	O
,	O
yielding	O
the	O
signed-digit	O
representation	O
.	O
</s>
