2s Compliment and sign and magnitude

2s compliment is a way of getting negative binary numbers.

 

Example:

10101011 in sign and magnitude to denary

The MSB is a minus if it is 1 and a positive if it is a zero so the number will be

-128+32+16+2+1= -85 in denary.

 

Example turn -90 to 2s compliment

To convert denary into 2s compliment you first write out what 90 is in unsigned binary:

01011010

Then you make it to 1s compliment which means flip it

10100101

and then convert that into 2s compliment which means add 1

10100110

 

Leave a comment