Difference between revisions of "Negative Numbers"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "=Two's Complement= Two's Complement uses a similar number system to binary except the msb or left hand bit is a negative value, meaning for 8 bit two's complement it would be ...")
(No difference)

Revision as of 16:57, 14 December 2016

Two's Complement

Two's Complement uses a similar number system to binary except the msb or left hand bit is a negative value, meaning for 8 bit two's complement it would be -128 instead of 128 like it is in regular 8bit binary.

-128 64 32 16 8 4 2 1

We can see that a 1 in the msb position, or the position of -128 would result in the binary number being negative as the other bits 64-1 only total 127. This means that even if there was a 1 in every position a two's complement number of 11111111 in binary would equal -1.

this means that in two's complement if the msb is a 0 the number is positive and if it is a 1 the number is negative.

Therefore we know that the smallest possible value in 8bit two's complement binary is 10000000 = -128 and the largest value is 01111111 = +127.