Binary Numbers, Bits, and Two’s Complement (LEGv8)


1. Numbers in Computers


2. Value of a Digit in Any Base

For any base bbb, the value of the ithi^\text{th}ith digit ddd is:

value = d_i × b^i

where iii starts at 0 at the rightmost digit.

Binary example: 1011₂ → decimal

1×23+0×22+1×21+1×20=8+0+2+1=11101×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8+0+2+1 = 11₁₀1×23+0×22+1×21+1×20=8+0+2+1=1110

(Insert figure: binary 1011 → decimal 11)

image.png


3. Bit Numbering in LEGv8 Doubleword