Minggu, 26 Juni 2016

how to represent negative bit?

how can bit represent negative?

lets say i want to represent 5
5 is
00000101 = 5

 how can i make it as negative?

the formula is flip all and flip the last bit

1st
raw:
00000101

2nd
flip
11111010

3rd
add 1 bit
11111011

and here we got the -5 as negative bits