2's Complement Subtraction

EXAMPLE - NORMAL CASE A > B:

01101011

-

1110

 = 

01101011 - 100000000

+

100000000 - 00001110

 = 

01101011 - 100000000

+

11111111 - 00001110 + 1

 = 

01101011 - 100000000

+

complement (00001110) + 1

 = 

01101011 - 100000000

+

11110001 + 1

 = 

01101011 - 100000000

+

11110010

 = 

101011101 - 100000000

 = 

 

 

01011101

 

 

 

EXAMPLE - CASE A < B:

1110

-

1101011

 = 

00001110 - 100000000

+

100000000 - 01101011

 = 

00001110 - 100000000

+

11111111 - 01101011 + 1

 = 

00001110 - 100000000

+

complement (01101011) + 1

 = 

00001110 - 100000000

+

10010100 + 1

 = 

00001110 - 100000000

+

10010101

 = 

10100011 - 100000000

 = 

 

 

-01011101

 

That is 10100011!

 

[Prev][TOC][Next]


Last updated 2000/09/26
© J.A.N. Lee, 2000.