EM03_S_WS_R1(Binary)

advertisement
Counting in Binary
A
A
A
A
bit is representative of 21 = 2 possible outcomes.
nib is 4 bits and therefore has 24 = 16 possible outcomes.
byte is 8 bits so this will have 28 = 256 possible outcomes.
word is 16 bits so this will have 216 = 65536 possible outcomes.
But who cares! This is all really just an idea of counting and
representing numbers in a way the computer understands.
The following is copied from the Wikipedia site.
How it works
In the binary number system, each numerical digit has two possible states (0
or 1) and each successive digit represents an increasing power of two. The
rightmost digit represents two to the zeroth power (i.e., it is the "ones
digit"); the digit to its left represents two to the first power (the "twos
digit"); the next digit to the left represents two to the second power (the
"fours digit"); and so on. (The decimal number system is essentially the
same, only that powers of ten are used: "ones digit", "tens digit" "hundreds
digit", etc.)
It is possible to use anatomical digits to represent numerical digits by
using a raised finger to represent a binary digit in the "1" state and a
lowered finger to represent it in the "0" state. Each successive
finger represents a higher power of two. With palms oriented
toward the counter's face, the values are:
Pinky Ring Middle Index Thumb
Power of two
Value
4
2
16
3
2
8
2
2
4
1
2
2
0
2
1
if only the right hand is used, and:
Decimal Binary
0
0
1
1
2
10
3
11
4
100
5
101
6
110
7
111
8
1000
9
1001
10
1010
Left Hand
Right Hand
Thumb Index Middle Ring Pinky Pinky Ring Middle Index Thumb
Power of two
29
28
27
26
25
24
23
22
21
20
Value
512
256
128
64
32
16
8
4
2
1
if both hands are used.
The values of each raised finger are added together to arrive at a total
number. In the one-handed version, all fingers raised is thus 31 (16 + 8 + 4
+ 2 + 1), and all fingers lowered (a fist) is 0. In the two-handed system,
all fingers raised is 1,023 (512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1)
and two fists (no fingers raised) represents 0.
It is also possible to have each hand represent an independent number between
0 and 31; this can be used to represent various types of paired numbers, such
as month and day, X-Ycoordinates, or sports scores (such as for table
tennis or baseball).
Examples
2
0
7=4+2+1
3=2+1
14 = 8 + 4 + 2
16
6=4+2
17 = 16 + 1
26 = 16 + 8 + 2
28 = 16 + 8 + 4
30 = 16 + 8 + 4 + 2
31 = 16 + 8 + 4 + 2 + 1
256
448 = 256 + 128 + 64
480 = 256 + 128 + 64 + 32
128 (if the right hand has the least
significant bits)
544 = 512 + 32
512
768 = 512 + 256
992 = 512 + 256 + 128 + 64 +
32
Does this help? It is not necessary to be able to count in
binary in order to program the BOE-bot, or to program anything
for that matter. But, it is helpful to understand it so that you
know what you are actually telling your computer to do.
GOOD LUCK!
Download