Professional Documents
Culture Documents
Howtoconvertdecimalnumbersto8bit2scomplement
ANSWERS
a)11111011
b)11101011
numeracy@mdx.ac.uk
c)10111101
Ifyouarenotsurehowtoconvertdecimalnumbersto8bit2scomplement
formthenhavealookatthisshortvideotutorialbyPCCvideos:
http://www.youtube.com/watch?v=WrSMzaEkrO4
Heresanexample:
Convert(47)into8bit2scomplement
Step1)changethedecimalnumbertobinary
101111
Step2)ensurethenumberis8bitbyaddingzerostothelefthandside
00101111
Step3)invertthenumberbychangingallthe1stozeroandallthezerosto1
11010000
Step4)add1totherighthandside
11010001
Sothefinalansweris
47=11010001
Nowtrythese:
a)Convertthedecimalnumber(5)into8bit2scomplement
b)Change(21)into8bit2scomplement
c)Express(67)asan8bit2scomplementnumber
Page1
LDUMaths,Stats&NumeracySupport
Binarysubtractionusing8bit2scomplement
Computersdonotmanagedirectsubtractionverywell.Wecangetroundthis
problembyaddingnegativenumberswhentheyarein8bit2scomplement
form.
Heresanexample:
15047
Step1)Convertthepositivenumberintobinarymakingsureitis8bitslong,if
itistooshortjustaddzerostothelefthandside.
150=10010110
Step2)Convertthenegativenumberinto8bits2scomplementform.DONOT
convertthepositivenumber.
47=11010001
Step3)Addthenumberstogetherusingbinaryaddition.
10010110
+
11010001
101100111
Step4)Ignoreanyoverflow:Ifyouhavea9bitnumberasyourfinalanswer,
ignorethebiggestplacevalueonthelefthandsidesothatyouransweris8
bitslong.
101100111
Sothefinalansweris 01100111
Nowtrythese:
1)155
2)77 21
3)10067
ANSWERS
1)00001010
2)00111000
3)00100001
numeracy@mdx.ac.uk
Page2