I'm trying to convert -24 to the hexadecimal representation but I always end up with a decimal of 8 which is incorrect.
Work:
-24 -> 24
24 in binary is: 11000 Now I take the two's complement: 11000 -> 00111 + 1 -> 01000 01000 is 8.
What did I do wrong?
I think I figured it out. I forgot to add the sign bit which would turn the answer to 101000 which is 40. 40 converted into hex is 0x18 which is correct.