FIT100
Another Example
Convert x = 141 to binary …
•
1. Let d the largest numbers so 2
d
£
x
•
2. Is d
³
0, i.e. more digits to process? No, end
•
3. Is x
³
2
d
, i.e. is x at least large a 2
d
?
•
3t. Y, binary place=1;x=x-2
d
•
3f. N, binary place=0
•
4. d = d - 1, go to Step 2
Place
x
2
d
x
³
2
d
bit
7=d
141
128
yes
1
6
13
64
no
0
5
13
32
no
0
4
13
16
no
0
3
13
8
yes
1
2
5
4
yes
1
1
1
2
no
0
0
1
1
yes
1