Presentation is loading. Please wait.

Presentation is loading. Please wait.

NUMBER SYSTEMS – PART I ICT1001 – I NTRODUCTION TO ICT L ECTURE 2.

Similar presentations


Presentation on theme: "NUMBER SYSTEMS – PART I ICT1001 – I NTRODUCTION TO ICT L ECTURE 2."— Presentation transcript:

1 NUMBER SYSTEMS – PART I ICT1001 – I NTRODUCTION TO ICT L ECTURE 2

2 2 You will see this icon often in the slides. Click on them to read more information about a certain topic.

3 INTRODUCTION TO NUMBER SYSTEMS

4 4 All (if not most) computer deals with numbers in one form or another (e.g. mp3, image, bioinformatics, DNA, weather prediction) Numbering is one of the most important concepts in computer system

5 Numbers can be represented in many formats 0123456789 Decimal ٠١٢٣٤٥٦٧٨٩ Arabic 〇一二三四五六七八九 Chinese/ Japanese ൦൧൨൩൪൫൬൭൮൯ Malay

6 6 The decimal system used in our everyday life cannot be efficiently represented in computer

7 7 Binary numbers are usually used where Instructions, input data and operations carried out in 0 s and 1 s 01

8 8 We need to also perform operations on real/floating numbers ( +, -, ×, ÷ precision)

9 POSITIONAL NUMBER SYSTEM 9

10 The number system we use is a positional system. Each digit position has an associated weight: It means 2164 10 = 2×10 3 + 1×10 2 + 6×10 1 + 4×10 0 For example The weight of each digit is a power of 10, increasing to the left. This represents decimal system

11 11 The decimal number system we use is a radix 10 positional system : each digit position has an associated weight: 3706.59 10 = 3×10 3 + 7×10 2 + 0×10 1 + 6×10 0 + 5×10 -1 + 9×10 -2 the weight of each digit is a power of 10, increasing to the left. A decimal point allows for negative powers:

12 12 In general, a number of the form “d 3 d 2 d 1 d 0.d - 1 d -2 ” in radix 10 positional system has the value: = d 3 ×10 3 + d 2 ×10 2 + d 1 ×10 1 + d 0 ×10 0 + d -1 ×10 -1 + d -2 ×10 -2 RADIX 10

13 13 Similarly, a number of the form “d 3 d 2 d 1 d 0.d -1 d -2 ” in radix 2 positional system has the value: = d 3 ×2 3 + d 2 ×2 2 + d 1 ×2 1 + d 0 ×2 0 + d -1 ×2 -1 + d -2 ×2 -2 RADIX 2

14 14 RADIX r

15 EXAMPLE – RADIX 2 15

16 16 Digital circuits can only represent two values: on and off, high and low, or 1 and 0. Numbers are represented by binary digits (bits) which can have a value of either 1 or 0. 10100011100 Most Significant Bit (MSB) Least Significant Bit (LSB)

17 17 NUMBER CONVERSION What is 1101 2 in decimal?

18 18 1101 2 = 1×8 + 1×4 + 0×2 + 1×1 = 13 10 10011100 2 = 1×128 + 0×64 + 0×32 + 1×16 + 1×8 + 1×4 + 0×2 + 0×1 = 156 10 1101.011 2 = 1×8 + 1×4 + 0×2 + 1×1 + 0×0.5 + 1×0.25 + 1×0.125 = 13.375 10 More examples:

19 NUMBER CONVERSION 19 An n-bit unsigned binary number can represent values from 0 to +(2 n -1) e.g. an 4-bit binary number can represent values from 0 to 1515 4-bit binary number

20 20 The powers of two are everywhere in digital design, so learn them as you work: 1 (2 0 ), 2 (2 1 ), 4 (2 2 ), 8 (2 3 ), 16 (2 4 ), 32 (2 5 ), 64 (2 6 ), 128 (2 7 ), 256 (2 8 ), 512 (2 9 ), 1024 (2 10 ), …

21 21 To speed up conversion, please learn how to convert using calculator (only non-programmable digital calculators are allowed) Link: http://cotips.blogspot.com/2012/10/how-to-convert-decimal-number-into.html

22 CONVERSION ALGORITHM 22 Divide by 2 Record quotient (Q) and remainder R Is Q=0 ? Collect R’s into desired binary number with first R as LSB and last R as MSB End Start Yes No Examples: 113 10 ÷ 2 = 56 remainder 1 (LSB) 56 10 ÷ 2 = 28 remainder 0 28 10 ÷ 2 = 14 remainder 0 14 10 ÷ 2 = 7 remainder 0 7 10 ÷ 2 = 3 remainder 1 3 10 ÷ 2 = 1 remainder 1 1 10 ÷ 2 = 0 remainder 1 (MSB) 113 10 = 111 0001 2 MSB LSB

23 23 HEX REPRESENTATION Binary digits for large numbers are long and tedious to write and remember Hexadecimal representation is usually used

24 24 HEXADECIMAL IS RADIX 16 0, 1, 2, 3, …, 8, 9, A, B, C, D, E, F These are the symbols used in Hexadecimal system

25 HEX CONVERSION 25 One hex digit equals four binary digits (since 2 4 = 16). Hence conversion is very simple. We arrange binary digits in groups of 4: B9F 16 = 1011 1001 1111 2 B 9 F

26 26 Hex representation is widely used for memory address and data. memory address

27 27 BinaryDecimalHex 0 0 00 0 0 0 111 0 0 1 022 0 0 1 133 0 1 0 044 0 1 55 0 1 1 066 0 1 1 177 1 0 0 088 1 0 0 199 1 0 A 1 0 1 111B 1 1 0 012C 1 1 0 113D 1 1 1 014E 1 1 15F This table shows binary, and hex representation for values from 0 to 15.

28 28 KNOWLEDGE CHECK TIME! Please attempt a quiz on LMS

29 29 Why 15? An n-bit unsigned binary number can represent values from 0 to +(2 n -1) A 4-bit unsigned binary number can represent values from 0 to +(2 4 -1)= 15 BACK

30 30 How do you understand this diagram? In the example in the slide it says: an 4-bit binary number can represent values from 0 to 15. So in the diagram you can see that value from 0 to 15 are representable. Values greater than 15 are not representable, we say it is “Overflow”. BACK

31 31 Examples: 113 10 ÷ 2 = 56 remainder 1 (LSB) 56 10 ÷ 2 = 28 remainder 0 28 10 ÷ 2 = 14 remainder 0 14 10 ÷ 2 = 7 remainder 0 7 10 ÷ 2 = 3 remainder 1 3 10 ÷ 2 = 1 remainder 1 1 10 ÷ 2 = 0 remainder 1 (MSB) 113 10 = 111 0001 2 MSB LSB In this example, we convert 113 in decimal into binary representation. First, divide 113 by 2, we get 1 as the remainder. Continue this step until we have 1 divide by 2, which gives 0 as the quotient. This is when we STOP. The last remainder is the first digit (most significant bit) in the binary representation. Try other example to practice this conversion. BACK

32 32 Why 1101 is B in hexadecimal? To understand why, first, convert 1101 to decimal 1101 = 1x8 + 1x4 + 0x2 + 1 = 13 13 in decimal is B in hexadecimal BACK


Download ppt "NUMBER SYSTEMS – PART I ICT1001 – I NTRODUCTION TO ICT L ECTURE 2."

Similar presentations


Ads by Google