CSC Week5 Data Representation Number Systems
CSC Week5 Data Representation Number Systems
&
Number Systems
Lesson Objectives
Binary Representation
Distinguish among categories of numbers
Describe Positional Notation
Convert numbers in other bases to base 10
Convert base-ten to numbers in other bases
Describe the relationship between bases 2,8,16
Explain the importance of computing of bases that
are powers of 2
Data and Computers
Computers are multimedia devices, dealing with a
vast array of information categories
Computers store, present, and help us modify
• Numbers
• Text
• Audio
• Images and graphics
• Video
3
Analog and Digital Information
Information can be represented in one of two ways:
analog or digital
Analog data
A continuous representation, analogous to the actual
information it represents
Digital data
A discrete representation, breaking the information up into
separate elements
4
Analog and Digital Information
Thermometer
is an
analog device
A mercury
thermometer
continually
rises in
direct
proportion to
the
temperature
5
Analog and Digital Information
Computers cannot work well with analog data, so we
digitize the data
Digitize
Breaking data into pieces and representing those
pieces separately
7
Binary Representations
One bit can be either 0 or 1
One bit can represent two things (Why?)
Two bits can represent four things (Why?)
How many things can three bits represent?
8
Binary Representations
Counting with
binary bits
9
Binary Representations
How many things can bits represent?
Why?
10
Binary System & Computers
Modern computers are binary machines-By understanding number
system, we understand how computing systems use binary number
system to accomplish their task
A digit in binary system is either 0 or1
The binary values in a computer are encoded using voltage levels:
– 0 is represented by a 0V signal (or low voltage)
– 1 is represented by a high voltage signal.
Bit – is a short expression for binary digit
Byte – eight binary digits
Word – a group of one or more bytes; the number of bits in a word is
the word length in a computer
We have 32-bit machine, 64-bit machine- affects the speed
Number Systems
Number categories
– Many categories: natural, negative, rational, irrational and many
others important to mathematics but irrelevant to the understanding
of computing
Number – unit belonging to an abstract mathematical
system and subject to specified laws of succession,
addition and multiplication
– Natural number is the number 0 or any other number obtained
adding repeatedly 1 to this number.
– A negative number is less than 0 and it is opposite in sign to a
positive number.
– An integer is any of positive or negative natural numbers
– A rational number is an integer or the quotient of any two integer
numbers
• is a value that can be expressed as a fraction
Number Systems …
The base of number system represents the number
of digits that are used in the system. The digits
always begin with 0 and continue through one less
than the base
Examples:
– There are two digits in base two (0 and 1)
– There are eight digits in base 8 (0 through 7)
– There are 10 digits in base 10 (0 through 9)
The base determines also what the position of the
digits mean
Positional Notation
It is a system of expressing numbers in which the digits are arranged in
succession and, the position of each digit has a place value and the number is
equal to the sum of the products of each digit by its place value
Example:
– Consider the number 954:
• 9 * 102 + 5 * 101 + 4 * 100 = 954
– Polynomial representation - formal way of representing numbers, where X is the
base of the number:
• 9 * X2 + 5 * X1 + 4 * X0
Formal representation – consider that the base of representation is B and the
number has n digits, where di represents the digit in the ith position.
– dn * Bn-1 + dn-1 * Bn-2 + …+ d2B +d1
– 642 is:
63 * 102 + 42 * 10 + 21 * 10 0
Other bases
What if 642 has the base of 13?
6 x 8² = 6 x 64 = 384
+ 4 x 8¹ = 4 x 8 = 32
+ 2 x 8º = 2 x 1 = 2
= 418 in base 10
111
Carry Values
0101
+1011
10000
We can check if the answer is correct by converting the
both operands in base 10, adding them and comparing the
result
Subtracting in Binary
The rules of the decimal base applies to binary as well.
To be able to calculus 0-1, we have to “borrow one”
from the next left digit.
More precisely, we have to borrow one power of the
base
12
0202
1010
-0111
0011
3567 16
32 D E F
36 222 16
32 16
47 62 13
32 48
15 14
Review Question 6
Convert number 11001111 to hexadecimal. The
answer is:
A. CF
B. BF
C. FC
D. I don’t know …
Review Question 7
Convert decimal number 375 to its octal
representation. The answer is
A. 567
B. 765
C. 556
D. I don’t know …
Review Question 8
Convert decimal number 37 to its binary
representation. The answer is:
A. 101001
B. 100101
C. 111000
D. I don’t know …