2's complement

From sciforums_encyclopedia
Jump to: navigation, search

a binary system that allows negative numbers in computers.


to represent -2 in 2's complement you take the complement of 2 and add 1.
thus 00000010=11111101, adding 1 gives 11111110.
to represent -9, 00001001=11110110, adding 1 gives 11111000.

any carries from the MSB (most significant bit) are ignored.