Binary and hex for each number, with the working on the hex line.
Convert the following decimal numbers into 8-bit 2’s complement binary numbers and their hexadecimal equivalent.
Q1.1 Binary conversions - #45 to binary 0.25
Convert #45 into 8-bit 2’s complement binary.
00101101
Q1.2 Binary conversions - #45 to hexadecimal 0.25
Convert #45 into 8-bit 2’s complement hexadecimal.
x2D
45 = 32 + 8 + 4 + 1.
Q1.3 Binary conversions - #-45 to binary 0.25
Convert #-45 into 8-bit 2’s complement binary.
11010011
Q1.4 Binary conversions - #-45 to hexadecimal 0.25
Convert #-45 into 8-bit 2’s complement hexadecimal.
xD3
Flip 00101101 to 11010010, add 1: 11010011. Hex from the nibbles 1101 = D, 0011 = 3.
Q1.5 Binary conversions - #127 to binary 0.25
Convert #127 into 8-bit 2’s complement binary.
01111111
Q1.6 Binary conversions - #127 to hexadecimal 0.25
Convert #127 into 8-bit 2’s complement hexadecimal.
x7F
The largest 8-bit value: 0 then seven 1s.
Q1.7 Binary conversions - #-1 to binary 0.25
Convert #-1 into 8-bit 2’s complement binary.
11111111
Q1.8 Binary conversions - #-1 to hexadecimal 0.25
Convert #-1 into 8-bit 2’s complement hexadecimal.
xFF
Flip 00000001 to 11111110, add 1: all ones.
Convert the following decimal numbers into 8-bit 2’s complement binary numbers and their hexadecimal equivalent.
Q1.1 Binary conversions - #100 to binary 0.25
Convert #100 into 8-bit 2’s complement binary.
01100100
Q1.2 Binary conversions - #100 to hexadecimal 0.25
Convert #100 into 8-bit 2’s complement hexadecimal.
x64
100 = 64 + 32 + 4.
Q1.3 Binary conversions - #-100 to binary 0.25
Convert #-100 into 8-bit 2’s complement binary.
10011100
Q1.4 Binary conversions - #-100 to hexadecimal 0.25
Convert #-100 into 8-bit 2’s complement hexadecimal.
x9C
Flip 01100100 to 10011011, add 1: 10011100. Nibbles 1001 = 9, 1100 = C.
Q1.5 Binary conversions - #-128 to binary 0.25
Convert #-128 into 8-bit 2’s complement binary.
10000000
Q1.6 Binary conversions - #-128 to hexadecimal 0.25
Convert #-128 into 8-bit 2’s complement hexadecimal.
x80
Fits: the most negative 8-bit value. Flipping 10000000 and adding 1 gives itself, which is why +128 does not fit.
Q1.7 Binary conversions - #200 to binary 0.25
Convert #200 into 8-bit 2’s complement binary.
N/A
Q1.8 Binary conversions - #200 to hexadecimal 0.25
Convert #200 into 8-bit 2’s complement hexadecimal.
N/A
Out of range. 8-bit two’s complement holds −128 to 127. Writing 11001000 = xC8 would be −56, not 200.
Convert the following decimal numbers into 8-bit 2’s complement binary numbers and their hexadecimal equivalent.
Q1.1 Binary conversions - #19 to binary 0.25
Convert #19 into 8-bit 2’s complement binary.
00010011
Q1.2 Binary conversions - #19 to hexadecimal 0.25
Convert #19 into 8-bit 2’s complement hexadecimal.
x13
19 = 16 + 2 + 1.
Q1.3 Binary conversions - #-19 to binary 0.25
Convert #-19 into 8-bit 2’s complement binary.
11101101
Q1.4 Binary conversions - #-19 to hexadecimal 0.25
Convert #-19 into 8-bit 2’s complement hexadecimal.
xED
Flip 00010011 to 11101100, add 1: 11101101. Nibbles 1110 = E, 1101 = D.
Q1.5 Binary conversions - #-129 to binary 0.25
Convert #-129 into 8-bit 2’s complement binary.
N/A
Q1.6 Binary conversions - #-129 to hexadecimal 0.25
Convert #-129 into 8-bit 2’s complement hexadecimal.
N/A
Out of range below −128. Not x7F: 01111111 is +127.
Q1.7 Binary conversions - #0 to binary 0.25
Convert #0 into 8-bit 2’s complement binary.
00000000
Q1.8 Binary conversions - #0 to hexadecimal 0.25
Convert #0 into 8-bit 2’s complement hexadecimal.
x00
Zero has one representation; negating it gives zero back.