Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/number-rep/twos-complement.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Suppose you use $N$ bits to represent integers with two's complement. How many p

* Zero: 1
* Positive: $2^{N-1} - 1$
* Negative: $2^{n-1}$
* Negative: $2^{N-1}$
:::

## Arithmetic and conversion
Expand Down Expand Up @@ -96,7 +96,7 @@ $$
- 2^{n-1} d_{n-1} + \sum_{i=0}^{n-2} 2^i d_i
$$

Positive and negative numbers can be computed using the same formula. Above, the sign is computed by multiplying the highest bit by $(-2^{N-1})$.
Positive and negative numbers can be computed using the same formula. Above, the sign is computed by multiplying the highest bit by $(-2^{n-1})$.

:::{card}
Example: $5$ and $-5$ in 4-bit two's complement
Expand Down