Transcript ch-3-binary

3
chapter
The Basics of Binary Numbers
Digital Computers represent information using two symbols,
0 and 1. Owing to its straightforward implementation in
electronic circuitry, the binary system is used by virtually all
modern computers.
Bits & Bytes
Decimal Digits (base 10):
0,1, 2, .., 9
Binary digIT = BIT (base 2):
0, 1
Byte: group of 8 bits (IPv4 Octet)
01100010
Slide 3-2
Bit Patterns: 01100001101..
length of pattern = 1  2 patterns
0
1
length of pattern = 2  4 patterns
00
01
10
11
Slide 3-3
Binary Patterns..
length of pattern = 3  8 patterns
000
001
010
011
100
101
110
111
Slide 3-4
Binary patterns..
length of pattern = 4  16 patterns
0000
0001
...
1110
1111
 Adding one bit to the length doubles the
number of patterns
 2n patterns, n = number of bits
Slide 3-5
The Power of Powers of 2..
Let’s Make a Deal!
Monty Hall offers you—
Deal #1:
$108,256,887,912.00
OR Deal #2 . .
Slide 3-6
The Power of Powers of 2..
Deal #2: A chessboard—
On the first square one penny, and on the second
square, two pennies, on the third, four pennies,
and so forth, until the last square is reached. You
get all the pennies.
Beware the Zonk!
Better ask the audience . .
Slide 3-7
Exercises (Optional ;-)
On what square of the chessboard did the
cumulative amount exceed Deal #1?
Is there a single square containing an amount >= to
Deal #1? If so, what is the first square contains
enough pennies to beat Deal #1?
If the pennies on square 64 were placed in a single
stack, how high would it be?
If all the pennies on the board were placed in a
single stack, how high would it be?
Slide 3-8
The Power of the Powers of 2..
Binary prefixes using SI symbols
These prefixes are in common
use for file and memory sizes
Each successive prefix is
multiplied by 1024 (210)
rather than the 1000 (103)
used by the SI prefix system.
Binary prefixes are often written
and pronounced identically to
the SI prefixes, despite the
resulting ambiguity.
Slide 3-9
The Quiz Show Question that
Stumped Bill Gates
Q: Exactly how many bits
are in a MegaByte?
Caveat:
 MegaByte can either
be a synonym for
MebiByte, or refer to
106 = 1,000,000 Bytes
A: ???
Slide 3-10
Large number names
Why American Billionaires Get No Respect in Europe..
Slide 3-11
Mapping Patterns to Binary
numbers..
binary
decimal
00
0
01
1
10
2
11
3 = 22-1
Slide 3-12
Mapping Patterns to Binary
numbers..
binary
decimal
000
0
001
1
…
…
110
6
111
7 = 23-1
Slide 3-13
Binary numbers..
For a binary code of length n:
 there exist 2n patterns
 represent 2n distinct numbers, 0 .. 2n-1
Slide 3-14
A Binary Conestoga Code
Ox Driver Commands:
1. Git!
2. Whoa!
3. Gee!
4. Haw!
What is the minimum
numbers of bits to
encode these 4
commands in binary?
Slide 3-15
Enhanced Conestoga Code
Ox Driver Commands:
1. Git!
2. Whoa!
3. Gee!
4. Haw!
5. Back!
What is the minimum numbers of bits to encode
these 5 commands in binary?
Slide 3-16
Next: PI Hour Year 1/19/2038!
Atomic vs. Optical Clocks
White Dwarf Chronometers
Belt-drives, Slot-Machines, Jump Hour
Slide 3-17
Next: Jeff Asks About ASCII..
http://www.asciitable.com/
codes:
decimal
octal
hexadecimal
Slide 3-18