ThmDex – An index of mathematical definitions, results, and conjectures.
Set of symbols
Alphabet
Deduction system
Theory
Zermelo-Fraenkel set theory
Set
Collection of sets
Set union
Successor set
Inductive set
Set of inductive sets
Set of natural numbers
Set of integers
Integer
Definition D6263
Integer base-2 representation
Formulation 0
Let $N \in \{ 1, 2, 3, \ldots \}$ be a D5094: Positive integer such that
(i) $r_0, r_1, \ldots, r_{N - 1} \in \{ 0, 1 \}$ are each a D1043: Boolean number
Then $ r_{N - 1}, \ldots, r_1, r_0$ is a base-2 representation in $N$ bits for $a \in \mathbb{Z}$ if and only if \begin{equation} a = - r_{N - 1} 2^{N - 1} + \sum_{n = 0}^{N - 2} r_n 2^n \end{equation}
Also known as
Two's complement integer base-2 representation
Children
D6269: N-bit integer
Results
R5720: Negative of base-2 integer iff bits negated plus one
Examples
Example 0
In the case of $N = 4$, 1111 is a base-2 representation of -1 because we have \begin{equation} \begin{split} -2^3 + 2^2 + 2^1 + 2^0 = -8 + 4 + 2 + 1 = -1 \end{split} \end{equation} Flipping the highest-order bit, 0111 is a base-2 representation of 7 because we have \begin{equation} \begin{split} 2^2 + 2^1 + 2^0 = 4 + 2 + 1 = 7 \end{split} \end{equation}