1000₁₀ in decimal is 11 1110 1000₂ in binary. The MSB within 8-bit is 1, so it is a negative number. Then use 2’s complement. The complement is 00010111₂ and we add 1₂ becomes 00011000₂. Finally, it is -24₁₀.
When the MSB within 8-bit is 0, it is a positive number. Then take the first 8 least significant bits (LSB).
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.