This commit is contained in:
Miloslav Ciz 2023-10-26 21:18:34 +02:00
parent 5c43f56dc3
commit 1c2717e515
8 changed files with 48 additions and 29 deletions

View file

@ -22,13 +22,13 @@ In other words given *N* bits, the positive values representable by two's comple
The following is a comparison of the different representations, notice the shining superiority of two's complement:
| value | unsigned | two's com. | sign-mag. | one's com. |
|-------|----------|------------|-----------|------------|
| 000 | 0 | 0 | 0 | 0 |
| 001 | 1 | 1 | 1 | 1 |
| 010 | 2 | 2 | 2 | 2 |
| 011 | 3 | 3 | 3 | 3 |
| 100 | 4 | -4 | -0 | -3 |
| 101 | 5 | -3 | -1 | -2 |
| 110 | 6 | -2 | -2 | -1 |
| 111 | 7 | -1 | -3 | -0 |
| value | unsigned | two's com. | sign-mag. | one's com. | biased |
| ----- | -------- | ---------- | --------- | ---------- | ------ |
| 000 | 0 | 0 | 0 | 0 | -4 |
| 001 | 1 | 1 | 1 | 1 | -3 |
| 010 | 2 | 2 | 2 | 2 | -2 |
| 011 | 3 | 3 | 3 | 3 | -1 |
| 100 | 4 | -4 | -0 | -3 | 0 |
| 101 | 5 | -3 | -1 | -2 | 1 |
| 110 | 6 | -2 | -2 | -1 | 2 |
| 111 | 7 | -1 | -3 | -0 | 3 |