|
|
Each digit of a byte represents a multiple of two. This can be understood easier by comparing it to the number
system people know so well, base 10. I will show you how to convert any number to base-ten. Let's
analyze the number 123456 in base ten first.
First label each digit in the number:152433425160
Notice we start at 0 on the right side of the number and move left.
The number of the label now becomes the exponent of the base that is multiplied by the digit. In this case, the base is ten.
1*105=1*100000=100000
2*104=2*10000=20000
3*103=3*1000=3000
4*102=4*100=400
5*101=5*10=50
6*100=6*1=6
Now we sum all these up to get the number in base-10. Which in this case, since the number was already base-10, we just get the original
number back.
100000+20000+3000+400+50+6=123456
Now lets apply this to a number in base-2. Lets say, 10011011.
Label the digits:1706051413021110
Create the exponential form for each bit:
1*27=1*128=128
0*26=0*64=0
0*25=0*32=0
1*24=1*16=16
1*23=1*8=8
0*22=0*4=0
1*21=1*2=2
1*20=1*1=1
Now sum them all up:
128+16+8+2+1=155
That means that 10011011 base-2 is equal to 155 base-10, or: 100110112=15510.
|
|