Presentation is loading. Please wait.

Presentation is loading. Please wait.

NUMBER SYSTEM Prepared by: Engr Zakria.

Similar presentations


Presentation on theme: "NUMBER SYSTEM Prepared by: Engr Zakria."— Presentation transcript:

1 NUMBER SYSTEM Prepared by: Engr Zakria

2 Introduction A number system defines how a number can be represented using distinct symbols. A number can be represented differently in different systems. For example, the two numbers (2A)16 and (52)8 both refer to the same quantity, (42)10, but their representations are different.

3 The decimal system (base 10)
The word decimal is derived from the Latin root decem (ten). In this system the base b = 10 and we use ten symbols S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} The symbols in this system are often referred to as decimal digits or just digits.

4 The binary system (base 2)
The word binary is derived from the Latin root bini (or two by two). In this system the base b = 2 and we use only two symbols, S = {0, 1} The symbols in this system are often referred to as binary digits or bits (binary digit).

5 The hexadecimal system (base 16)
The word hexadecimal is derived from the Greek root hex (six) and the Latin root decem (ten). In this system the base b = 16 and we use sixteen symbols to represent a number. The set of symbols is S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} Note that the symbols A, B, C, D, E, F are equivalent to 10, 11, 12, 13, 14, and 15 respectively. The symbols in this system are often referred to as hexadecimal digits.

6 The octal system (base 8)
The word octal is derived from the Latin root octo (eight). In this system the base b = 8 and we use eight symbols to represent a number. The set of symbols is S = {0, 1, 2, 3, 4, 5, 6, 7}

7 COMMON NUMBER SYSTEM System Base Symbols Used by humans?
Used in computers? Decimal 10 0, 1, … 9 Yes No Binary 2 0, 1 Octal 8 0, 1, … 7 Hexa- decimal 16 0, 1, … 9, A, B, … F

8 Decimal Binary Octal Hexa- decimal 1 2 10 3 11 4 100 5 101 6 110 7 111

9 Decimal Binary Octal Hexa- decimal 8 1000 10 9 1001 11 1010 12 A 1011 13 B 1100 14 C 1101 15 D 1110 16 E 1111 17 F

10 Decimal Binary Octal Hexa- decimal 16 10000 20 10 17 10001 21 11 18 10010 22 12 19 10011 23 13 10100 24 14 10101 25 15 10110 26 10111 27 Etc.

11 Conversion Among Bases
The possibilities: Decimal Octal Binary Hexadecimal

12 Quick Example 2510 = = 318 = 1916 Base

13 Decimal to Decimal (just for fun)
Octal Binary Hexadecimal

14 Weight 12510 => 5 x 100 = x 101 = x 102 = Base

15 Binary to Decimal Decimal Octal Binary Hexadecimal

16 Binary to Decimal Technique
Multiply each bit by 2n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results

17 Example Bit “0” => 1 x 20 = x 21 = x 22 = x 23 = x 24 = x 25 = 32 4310

18 Octal to Decimal Decimal Octal Binary Hexadecimal

19 Octal to Decimal Technique
Multiply each bit by 8n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results

20 Example 7248 => 4 x 80 = x 81 = x 82 =

21 Hexadecimal to Decimal
Octal Binary Hexadecimal

22 Hexadecimal to Decimal
Technique Multiply each bit by 16n, where n is the “weight” of the bit The weight is the position of the bit, starting from 0 on the right Add the results

23 Example ABC16 => C x 160 = 12 x 1 = B x 161 = 11 x 16 = A x 162 = 10 x 256 = 2560 274810

24 Decimal to Binary Decimal Octal Binary Hexadecimal

25 Decimal to Binary Technique Divide by two, keep track of the remainder
First remainder is bit 0 (LSB, least-significant bit) Second remainder is bit 1 Etc.

26 Example 12510 = ?2 12510 =

27 Octal to Binary Decimal Octal Binary Hexadecimal

28 Octal to Binary Technique
Convert each octal digit to a 3-bit equivalent binary representation

29 Example 7058 = ?2 7058 =

30 Hexadecimal to Binary Decimal Octal Binary Hexadecimal

31 Hexadecimal to Binary Technique
Convert each hexadecimal digit to a 4-bit equivalent binary representation

32 Example 10AF16 = ?2 A F 10AF16 =

33 Decimal to Octal Decimal Octal Binary Hexadecimal

34 Decimal to Octal Technique Divide by 8 Keep track of the remainder

35 Example = ?8 8 19 2 8 2 3 8 0 2 = 23228

36 Decimal to Hexadecimal
Octal Binary Hexadecimal

37 Decimal to Hexadecimal
Technique Divide by 16 Keep track of the remainder

38 Example = ?16 77 2 16 = D 0 4 = 4D216

39 Binary to Octal Decimal Octal Binary Hexadecimal

40 Binary to Octal Technique Group bits in threes, starting on right
Convert to octal digits

41 Example = ?8 = 13278

42 Binary to Hexadecimal Decimal Octal Binary Hexadecimal

43 Binary to Hexadecimal Technique Group bits in fours, starting on right
Convert to hexadecimal digits

44 Example = ?16 B B = 2BB16

45 Octal to Hexadecimal Decimal Octal Binary Hexadecimal

46 Octal to Hexadecimal Technique Use binary as an intermediary

47 Example 10768 = ?16 E 10768 = 23E16

48 Hexadecimal to Octal Decimal Octal Binary Hexadecimal

49 Hexadecimal to Octal Technique Use binary as an intermediary

50 Example 1F0C16 = ?8 1 F C 1F0C16 =

51 Exercise – Convert ... Decimal Binary Octal Hexa- decimal 33 1110101
703 1AF Don’t use a calculator! Skip answer Answer

52 Exercise – Convert … Decimal Binary Octal Hexa- decimal 33 100001 41
Answer Decimal Binary Octal Hexa- decimal 33 100001 41 21 117 165 75 451 703 1C3 431 657 1AF

53 Common Powers (1 of 2) Base 10 Power Preface Symbol pico p nano n
10-12 pico p 10-9 nano n 10-6 micro 10-3 milli m 103 kilo k 106 mega M 109 giga G 1012 tera T Value .001 1000

54 Common Powers (2 of 2) Base 2 What is the value of “k”, “M”, and “G”?
Preface Symbol 210 kilo k 220 mega M 230 Giga G Value 1024 What is the value of “k”, “M”, and “G”? In computing, particularly w.r.t. memory, the base-2 interpretation generally applies

55 Review – multiplying powers
For common bases, add powers ab  ac = ab+c 26  210 = 216 = 65,536 or… 26  210 = 64  210 = 64k

56 Binary Addition (1 of 2) Two 1-bit values A B A + B 1 10 “two”

57 Binary Addition (2 of 2) Two n-bit values Add individual bits
Propagate carries E.g., 1 1

58 Multiplication (1 of 3) Decimal (just for fun)
35 x

59 Multiplication (2 of 3) Binary, two 1-bit values A B A  B 1

60 Multiplication (3 of 3) Binary, two n-bit values
As with decimal values E.g., x

61 Fractions Decimal to decimal (just for fun)
3.14 => 4 x 10-2 = x 10-1 = x 100 =

62 Fractions Binary to decimal
=> 1 x 2-4 = x 2-3 = x 2-2 = x 2-1 = x 20 = x 21 =

63 Fractions Decimal to binary 3.14579 11.001001...
x x x x x x etc.

64 Exercise – Convert ... Decimal Binary Octal Hexa- decimal 29.8
3.07 C.82 Don’t use a calculator! Skip answer Answer

65 Exercise – Convert … Decimal Binary Octal Hexa- decimal 29.8
Answer Decimal Binary Octal Hexa- decimal 29.8 35.63… 1D.CC… 5.8125 5.64 5.D 3.07 3.1C 14.404 C.82

66


Download ppt "NUMBER SYSTEM Prepared by: Engr Zakria."

Similar presentations


Ads by Google