Chapter 3 part i data representation
-
Upload
azimjon-khamdamov -
Category
Technology
-
view
270 -
download
1
Transcript of Chapter 3 part i data representation
Data Representation
Chapter 3 Part I
Contents
Introduction to number system Different bases numbers Converting different bases numbers
into decimal Converting decimal numbers into
different bases Converting floating points
Objectives
At the end of this chapter, students should be able to: Explain the different bases number
system Convert numbers into different bases Convert floating numbers into different
bases
Introduction
Human use decimal (base 10) number system to
count and perform arithmetic. Computer
uses binary (base 2) number system. each digit is known as a bit (0 and 1).
Introduction
Computer stores and manipulates the bits in group of 8(byte), 16 (halfword), 32 (word) and 64 (double word).
Number of bits used in calculations affects the accuracy and size limitations of numbers manipulated by the computer.
Introduction
Counting in base 10 E.g.: 0, 1, 2, 3, …, 10, …, 100,…
10 (1 x 101 + 0 = 10 + 0)63 (6 x 101 + 3 x 100 = 60 + 3)747 (7 x 102 + 4 x 101 + 7 x 100 = 700 + 40 + 7)
Different bases numbers
Different bases numbers Number can be represented in different bases. Different name of bases:
Base 2 binary Base 3 ternary Base 4 quaternary Base 5 quinary Base 6 senary Base 7 septenary Base 8 octal Base 9 nonary Base 10 decimal Base 11 undenary Base 12 duodecimal Base 16 hexadecimal Base 20 vigesimal Base 60 sexagesimal
Different bases numbers
Base 2 includes (0, 1) Base 3 includes (0,1,2) Base 4 includes (0,1,2,3) Base 9 includes ? Base 12 includes ? Base 16 includes?
Different bases numbers
Base 2 0,1, 10, 11,100, 101, … Base 3 0,1,2, 10, 11, 12, 20, 21, … Base 4 0,1,2,3,10,11,12, 13, 20, … Base 9 ? Base 12 ? Base 16 ?
Converting different bases numbers into decimal
Converting different bases number into decimal
Counting in base 8 Example: 1278
(1 x 82) + (2 x 81) + (7 x 80) = 64 + 16 + 7 = 8710
Converting different bases numbers into decimal
Counting in base 2: E.g.:10112
(1 x 23) + 0 + (1 x 21) + (1 x 20) = 8+0+2+1 = 1110
Converting decimal numbers into different bases
Converting decimal numbers into different bases
Converting to base 8 E.g.: 30
30 / 8 = 3 Balance 63 / 8 = 0 Balance 33010 = 368
Converting decimal numbers into different bases
Converting to base 4 E.g.: 30
30 / 4 = 7 Balance 27 / 4 = 1 Balance 31 / 4 = 0 Balance 13010 = 1324
Converting decimal numbers into different bases
Converting to base 2 E.g.: 30
30 / 2 = 15 Balance 015 / 2 = 7 Balance 17 / 2 = 3 Balance 13 / 2 = 1 Balance 11 / 2 = 0 Balance 13010 = 111102
Converting floating points
Converting floating points
1010/2 = 5 Balance 0 5/2 = 2 Balance 12/2 =1 Balance 01/2 =0 Balance 11010
.250.25 X 2 = 0.5 00.5 X 2 = 1 1
01
•Convert decimal to base 2 floating number•E.g.: 10.25
1010.01
Converting floating points
101(1x22) + 0 + (1x20) 4 + 15
1101(1 x ½)+(1x ¼)+(1x 1/16)0.5 + 0.25 + 0.06250.8125
Converting floating points E.g.: 101.1101 Convert base 2 floating number to decimal
5.8125
End of Chapter 3 Part I