Numbering Systems PowerPoint

advertisement
Introduction to Numbering Systems and Binary
The Decimal Number System (base-10)
The numbering system we use is called
decimal. It consists of 10 numbers: 0123456789.
It is used by most civilizations today.
In the past, some civilizations used other
numbering systems. For example, the
Babylonians used the sexagesimal system,
based on the number 60. The Babylonians
divided the circle into 360 degrees (a multiple of
60).
The Mayas used the vigesimal system, based on
the number 20.
The Unary Numbering System (base-1)
A base-1 numbering system was used by some people in ancient times. In this
system, you simply put a mark (or a 1) for each item you are counting. For
example, bones have been found with 29 and 30 notches, possibly corresponding
to the cycle of the moon:
Placing a mark for every item you are counting would be quite cumbersome if
you need to count larger quantities. A better way is to have special symbols to
represent larger numbers. For example, Roman numerals use V for 5, X for
10, L for 50, etc. The ancient Egyptians also used symbols to represent larger
quantities. The number below is 2,382,358.
The Binary Numbering System (base-2)
A bit (short for binary digit) is the smallest unit of data in a computer. A bit has a
single binary value, either 0 or 1. It is implemented with an electronic switch that is
either on or off.
If the switch is on, it is equal to 1.
If the switch is off, it is equal to 0.
You may notice the
symbol on power switches. This symbol
composed of the 1 and 0 (on and off).
When we have a lot of these on/off electronic switches together we come up with a
numbering system that only has two digits – 1 and 0. This numbering system is
called binary.
On
Off
On
Off
On
On
1
0
1
0
1
1
This table shows six switches, or bits.
It stores the binary number 101011.
Bytes
A bit can store either a 0 or 1. If we group eight bits together we form a byte.
To convert between decimal and binary, you
can use the Windows calculator in programmer
mode or use an online binary calculator.
Convert these bytes from binary to decimal:
(a) 11110000
Answer: 240
(b) 10101010
Answer: 170
The smallest number a byte can be is:
00000000 = 0 (decimal)
The largest number a byte can be is:
11111111 = 255 (decimal)
Therefore, a byte can store a decimal number from 0 to 255.
Binary Prefixes
Unit
Size
What it Can Store
Bit
0 or 1
One bit of information can store answers to yes/no
questions: "Do you have a driver’s license?"
Byte
8 bits
A byte can store a decimal number from 0 to 255.
Using ASCII, a byte can store one text character.
Kilobyte (KB)
1,000 bytes
2 KB could store one page of a document. 50 KB
can store a very low resolution photograph.
Megabyte (MB)
1,000,000 bytes
1 MB can store a novel. 5 MB can store the
complete works of Shakespeare or 30 seconds of
TV-quality video. 640 MB can store a music CD.
Gigabyte (GB)
1,000,000,000 bytes
4 GB can store a DVD movie. 16 GB can store a
Blu-ray or HD movie.
Terabyte (TB)
1,000,000,000,000 bytes
10 TB can store the printed section of the Library of
Congress.
Petabyte (PB)
1,000,000,000,000,000 bytes
250 PB can store everything ever printed on Earth.
Exabyte (EB)
1,000,000,000,000,000,000 bytes
The capacity of large data centers such as Google
or Facebook are in the exabytes.
Zettabyte (ZB)
1,000,000,000,000,000,000,000
bytes
In 2012, it was estimated that the total amount of
global data is 2.7 ZB.
Yottabyte (YB)
1,000,000,000,000,000,000,000,000
bytes
Doing Calculations with Bytes
Example 1: You have some video files that are 2 GB each. How many of
these files will fit on a 1 TB external hard drive?
Solution: 1 TB
1,000,000,000,000 1,000
------- = ------------------------ = -------- = 500 video files
2 GB
2,000,000,000
2
Example 2: How 8 MB photos will fit on a phone with 24 GB free space?
Solution: 24 GB
24,000,000,000
24,000
--------- = ---------------------- = --------- = 3000 photos
8 MB
8,000,000
8
Storing Text using Binary
Since computers only store bytes of data (a number between 0 and 255), in order to
store text we need a coding system to translate numbers into text. One that has
been used for decades is called ASCII. Each character is stored using a byte.
Unicode – Since the ASCII
coding system only has the
characters for Latin derived
languages, Unicode is a
newer coding system used to
store the characters for almost
all writing systems (see table
on right).
Each Unicode character
requires 2 bytes of storage
giving a total of 65,536
different characters.
Here is a complete Unicode
chart:
http://www.tamasoft.co.jp/en/g
eneral-info/unicode.html
Most Writing Systems Used Today
Arabic
Gurmukhi (Punjabi)
Myanmar (Burmese)
Armenian
Han (Kanji, Hanja, Hanzi)
N'Ko
Bengali
Hangul (Korean)
Oriya
Braille
Hebrew
Osmanya
Canadian
Aboriginal
Syllabics
Hiragana and Katakana
(Japanese)
Silot Nagri
Cherokee
International Phonetic
Alphabet (IPA)
Syriac
Coptic
Khmer (Cambodian)
Tamil
Cyrillic
Kannada
Telugu
Devanagari
Lao
Thai
Ethiopic
Latin
Tibetan
Georgian
Limbu
Tifinagh
Greek
Malayalam
Yi
Gujarati
Mongolian
Zhuyin (Bopomofo)
Extinct Writing Systems for Academic Purposes
Cuneiform
Ogham
Runic
Deseret
Old Italic (Etruscan)
Shavian
Linear B
Old Persian
Ugaritic
Kharoshti
Phoenician
Summary: Storing Text on a Computer
Counting in Binary (for programming majors)
Counting in binary can be tricky to understand for newcomers.
One method that might help you count in binary would be to
use the decimal system, but only keep the numbers that
contain 0's and 1's. The table above shows these numbers
in bold.
The table on the right shows how to count to 12 in binary.
Now you can understand a classic programmer joke:
There’s 10 types of people. Those who understand binary
and those who don’t.
Binary
Decimal
0
0
1
1
10
2
11
3
100
4
101
5
110
6
111
7
1000
8
1001
9
1010
10
1011
11
1100
12
Converting Binary to Decimal Manually (for programming majors)
The easiest way to convert a binary number to decimal is to use the Windows
calculator. To do it manually follow these steps:
(1) write the binary number (e.g. 10101110)
(2) on the rightmost number, put a 1 on top of it. On the next number to the
left, put a 2 on top of it. Keep doubling the numbers until you have a number
on top of each binary digit.
(3) add up all the numbers that have a 1 below them.
Example: Convert binary 10101110 to decimal
128
1
64
0
32
1
16
0
8
1
4
1
128 + 32 + 8 + 4 + 2 = 174
2
1
1
0
Download