lecture 6 Flashcards
information encoding
machine language
binary numbers only
binary encoding
convert data into different form or representation
base-10
decimal numbers
0-9
base-2
binary
0-1
base-16
hexidecimal
0-9, A-F
base-10 equation
v = Σ (10^i)(d)
*key:
v –> base-10 value
i –> digit position (increases right
to left starting @ 0)
d –> decimal digit
what is each base-10 digit multiplied by?
power of 10
base-10 example)
173
1 7 3
= 173
how is this equal to 173?
1 7 3
10^2 + 10^1 + 10^0
= 1(10^2) + 7(10^1) + 3(10^0)
= 173
base-2 equation
v = Σ 2^i bi
*key:
v –> base-2 number
i –> digit position (increasing
from right to left, starting @
0)
b –> binary digit (either 1 or 0)
what is each base-2 digit multiplied by?
power of 2
base-2 example)
011111010000
= 2000 (base-10)
how is this equal to 2000?
0 1 0 0 1 0 0 1
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
= 1(2^6) + 1(2^3) + 1(2^0)
= 64 +8 +1
= 73
what is the most significant bit?
msb –> always going to be the greatest power of 2
(right most bit)
what is the least significant bit?
lsb –> always going to be the lowest power of 2
(left most bit)
0 1 0 0 1 0 0 1
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
what is the msb?
2^7
- greatest power of 2 (right most bit)
0 1 0 0 1 0 0 1
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
what is the lsb?
2^0
- least power of 2 (left most bit)
**always going to be 2^0
decimal to binary algorithm
v/2 = quotient, remainder = bit (going to be 0 or 1)
quotient/2, remainder = next bit (going to be 0 or 1)
STEPS:
divide v by 2
remainder becomes next bit
quotient becomes next v
**repeat until v = 0
- msb –> last bit found when v
= 0
- lsb –> first bit found
* first division –> remainder = lsb
* last division –> remainder = msb