Representation
Terminology
- least significant bit (lsb): least magnitude bit.
- most significant bit (msb): greatest magnitude bit.
- unsigned integers: k bit sequence representing 0 to 2k-1
- two's complement: number representation for signed integers.
Unsigned Binary Decimal 2s Complement Binary Decimal
0000 0000 0000 0000 0 0000 0000 0000 0000 0
0000 0000 0000 0001 1 0000 0000 0000 0001 1
0000 0000 0000 0010 2 0000 0000 0000 0010 2
1111 1111 1111 1101 65533 0111 1111 1111 1111 32767
1111 1111 1111 1110 65534 1000 0000 0000 0000 -32768
1111 1111 1111 1111 65535 1000 0000 0000 0001 -32767
1000 0000 0000 0010 -32766
no negative representation