Number representations and codes
Đã giới thiệu| English | Ý nghĩa |
|---|---|
| binary/ˈbaɪnəri/ | binary |
| hexadecimal/ˌheksəˈdesɪml/ | hexadecimal |
| two's complement/tuːz ˈkɒmplɪmənt/ | two's complement |
| overflow/ˌəʊvəˈfləʊ/ | overflow |
Numbers in two voltage levels
- Binary with positional weights; hexadecimal groups 4 bits per digit (
1001 1100 = 9C). Conversions check by re-adding weights. - Two's complement negates by invert-plus-one; the N-bit range is $-2^{N-1}…2^{N-1}-1$; overflow = like signs in, unlike sign out.
$156 = 10011100_{2} = 9C_{16}$; -5 in 8 bits is 11111011; 90 + 70 = 160 > 127, and the 8-bit result reads negative — overflow caught by the sign rule.

{exercise:uni-ee3x-numbers}
Add the 8-bit signed values 0101 1010 (90) and 0100 0110 (70). What happens?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
Two like signs in and an unlike sign out is overflow. A carry-out alone is NOT overflow for signed arithmetic — only the sign rule decides.
In 8-bit two's complement, the bits 10011100 decode as —
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
MSB 1 means negative: value = unsigned - 256 = 156 - 256 = -100. The same bits read +156 as unsigned - the interpreter decides.
8-bit signed: 100 + 50 computes 10010110. What happened?
Độ khó 1/5 · 100 xu + phần thưởng nhỏ khi hoàn thành lần đầu tiên hôm nay
150 > 127 leaves the range; the bits decode to -106. Detection is the sign rule (two positives, negative result) - carry-out alone is NOT overflow.