Download presentation

Presentation is loading. Please wait.

Published bySheldon Newingham Modified over 3 years ago

2
NUMBER SYSTEMS

3
The BASE of a number system Determines the number of digits available In our number system we use 10 digits: 0-9 The base in our system is 10 It is called decimal or denary

4
The BASE of a number system Computers are bi-stable devices A bi-stable device has only two possible states: ON or OFF Hence a base 2 number system is enough for such devices A base 2 number system is called binary The 2 possible digits are 0 and 1

5
The BASE of a number system An other number system used with computers is Hexadecimal The base for this system is 16 The 16 possible digits are 0 – 9 and A - F

6
The BASE of a number system SystemBaseDigits used Decimalbase 10 e.g. 5 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binarybase 2 e.g. 10 2 0, 1 Hexadecimalbase 16 e.g. 3C 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

7
Place values The position of each number within a series of numbers is very important The position of the number determines how large it is All number bases have their place values

8
Place values In base 10, the place values are as follows: 10 6 10 5 10 4 10 3 10 2 10 1 10 0 1 000 000100 00010 0001000100101 Values go up in powers of 10 as you move from left to right

9
Place values In base 2, the place values are as follows: Values go up in powers of 10 as you move from left to right. 2929 2828 2727 2626 2525 2424 23232 2121 2020 5122561286432168421

10
Binary to Decimal Conversion To convert binary numbers to decimal we need to follow these four steps: 1. Write down the place values, starting from the right hand side 2. Write each binary digit under its place value 3. Multiply each binary digit by its place value 4. Add up the total number

11
Binary to Decimal Conversion Example Convert the binary number 10101 to decimal. 2424 23232 2121 2020 Step 1Place values 168421 Step 2Binary digits 10101 Step 31 × 16 = 16 0 × 8 = 0 1 × 4 = 4 0 × 2 = 0 1 × 1 = 1 Step 4Decimal16 +0 +4 +0 +1 =21 Answer: 10101 2 = 21 10

12
Decimal to Binary Conversion To convert a decimal number to binary 1. Successively divide the decimal number by 2 and record the remainder 2. Use the numerator for the next division until the result of the division is 0 3. The remainder (1 or 0) of each division makes up the binary number

13
Decimal to Binary Conversion To convert a decimal number to binary 1. The remainder of the first division gives the LEAST significant bit 2. The remainder of the next division gives the NEXT bit etc. 3. This method produces the bits in reverse order - reading down the way gives the bits in order of right to left

14
Decimal to Binary Conversion Example Convert 37 10 in binary 237 218with a remainder of1 29 0 24 1 22 0 21 0 0 1 Answer : 37 10 = 100101 2

15
Decimal to Binary Conversion An alternative method is to use the place values. To convert a decimal number to binary follow these steps: 1.Write down the place values up to the one which is just greater than the decimal number we need to convert

16
Decimal to Binary Conversion Let us consider the decimal number 37, we would need to write down the place values up to 64 2626 2525 2424 23232 2121 2020 Place values 6432168421

17
Decimal to Binary Conversion 2.Work through the place values deciding on whether to place a 1 or a 0 under the place value

18
Decimal to Binary Conversion Since 37 is less than 64 we write a 0 under the 64. We would need a 32 so we write a 1 under the 32 2626 2525 2424 23232 2121 2020 Place values 6432168421 Binary number 01

19
Decimal to Binary Conversion This would leave us with 37 – 32 = 5. Now we are left with 5 to distribute under the other place values. Since 5 is less than 16 and 8 we write a 0 under both. We can now place a 1 under 4. This leaves us with 5 – 4 = 1. Hence we put a 0 under 2 and a 1 under 1. 2626 2525 2424 23232 2121 2020 Place values 6432168421 Binary number 0100101 So 37 10 = 100101 2

20
The Hexadecimal (Hex) number system Base 16 16 symbols: 0 – 9 & A – F Place values increase in powers of 16 The advantage of the hexadecimal system is its usefulness in converting directly from a 4-bit binary number

21
Equivalent numbers in different bases DecimalBinaryHex 000000 100011 200102 300113 401004 501015 601106 701117 810008 910019 DecimalBinaryHex 101010A 111011B 121100C 131101D 141110E 151111F

22
Hex to Decimal Conversion To convert Hex numbers to decimal we need to follow these four steps: 1. Write down the place values, starting from the right hand side 2. Write each hex digit under its place value 3. Multiply each hex digit by its place value 4. Add up the total number

23
Hex to Decimal Conversion Example Convert 3CD 16 to its decimal equivalent. 16 2 16 1 16 0 Step 1Place value256161 Step 2Hex3CD Step 3 256 × 3 = 768 16 × 12 = 192 1 × 13 = 13 Step 4Decimal768 +192 +13 =973 Answer: 3CD 16 = 973 10

24
Decimal to Hex Conversion To convert a decimal number to hex Successively divide the decimal number by 16 and record the remainder Use the numerator for the next division until the result of the division is 0 The remainder of each division makes up the hex number

25
Decimal to Hex Conversion Example 1 Convert 41 10 to hex Answer : 41 10 = 29 16 1641 162with a remainder of9 0 2

26
Decimal to Hex Conversion Example 3 Convert 109 10 to hex Answer : 109 10 = 6 13 16 = 6D 16 16109 166with a remainder of13 0with a remainder of6

27
Decimal to Hex Conversion An alternative method is to use the place values. To convert a decimal number to hex follow these steps: 1.Write down the place values up to the one which is just greater than the decimal number we need to convert

28
Decimal to Hex Conversion Let us consider the decimal number 356, we would need to write down the place values up to 4096 16 3 16 2 16 1 16 0 Place values 4096256161

29
Decimal to Hex Conversion 2.Work through the place values deciding on weather to place a 0 or a value from 1 - 15 under the place value.

30
Decimal to Hex Conversion Since 356 is less than 4096 we write a 0 under the 4096. We would need a 256 so we write a 1 under the 256. 16 3 16 2 16 1 16 0 Place values 4096256161 Hex number01

31
Decimal to Hex Conversion This would leave us with 356 – 256 = 100. Now we are left with 100 to distribute under the other place values. Since 100 ÷ 16 = 6 r 4 we write a 6 under 16. This leaves us with 4 ones. Hence we put a 4 under 1. 16 3 16 2 16 1 16 0 Place values4096256161 Hex number0164 So 356 10 = 164 16

32
Binary to Hex Conversion To convert numbers from binary to hex and vice versa, we need to use the conversion table shown below BinaryHex 00000 00011 00102 00113 01004 01015 BinaryHex 1011B 1100C 1101D 1110E 1111F BinaryHex 01106 01117 10008 10019 1010A

33
Binary to Hex Conversion For each digit in the hex number, write down the equivalent 4-bit binary digit. Example Convert C3 16 to its binary equivalent Answer : C3 16 = 11000011 2 HexadecimalC3 Binary11000011

34
Hex to Binary Conversion Divide the binary number into 4-bit groups starting from the right (LSB). If we end up with a group of less than 4 bits on the left, add 0s to fill up the required places. Then translate each group into its equivalent hexadecimal number below.

35
Hex to Binary Conversion Example Convert 1011101010 2 to hexadecimal Answer : 1011101010 2 = 2EA 16 Binary001011101010 Hexadecimal2EA

36
Binary Arithmetic

37
Addition of Binary Numbers 13 + 17 30 Note: 3 + 7 = 10 which we write as 0 carry 1. 0 1 1 0 1 + 1 0 0 0 1 1 1 1 1 0 Similarly in binary: 1 + 1 = 0 carry 1.

38
Addition of Binary Numbers 13 + 17 1 31 Note: 3 + 7 + 1= 11 which we write as 1 carry 1. 0 1 1 0 1 + 1 0 0 0 1 0 0 0 0 1 1 1 1 1 1 Similarly in binary: 1 + 1 + 1 = 1 carry 1.

39
Numeric Overflow 13 + 17 11 41 Note: The number 41 cannot be represented using 5 bits since with 5 bits we can represent the range from 0 to 31. 0 1 1 0 1 + 1 0 0 0 1 0 1 0 1 1 0 1 0 0 1 1 Numeric overflow occurs if a number too large to be represented is encountered. For example a 5 bit register is used to store the decimal number 41.

40
Negative Numbers Negative numbers can be represented in binary using one of the following ways: Sign and Magnitude Codes (SM) Two's Complement (2C)

41
The Most Significant Bit is used to represent the sign of the number Sign and Magnitude Codes The other bits represent the magnitude of the number.

42
Example: Sign and Magnitude Convert 24 to Sign and Magnitude representation using an 8-bit register format. 24 In binary 1 1 0 0 0 24 Using 7 bits 0 0 1 1 0 0 0 24 SM 0 0 0 1 1 0 0 0 O since number is positive

43
Example: Sign and Magnitude Convert - 24 to Sign and Magnitude representation using an 8-bit register format. 24 In binary 1 1 0 0 0 24 Using 7 bits 0 0 1 1 0 0 0 24 SM 1 0 0 1 1 0 0 0 1 since number is negative

44
Two's Complement (2C) The bits have the same place values as binary numbers. However the Most Significant Bit is also used to represent the sign of the number.

45
Example: Two's Complement Complement 67 using a 9-bit register 67 In binary 0 1 0 0 0 0 0 1 1 Reverse Bits 1 0 1 1 1 1 1 0 0 Add 1 1 0 1 1 1 1 1 0 1 This gives -67

46
Range for 2C Representation 1-bit register 0 represents 0 1 represents -1 2-bit register 0 0 represents 0 0 1 represents 1 1 0 represents -2 1 1 represents -1 1-bit register -1, 0 2-bit register -2, -1, 0, 1 3-bit register 0 0 0 represents 0 0 0 1 represents 1 0 1 0 represents 2 0 1 1 represents 3 3-bit register-4, -3, -2, -1, 0, 1, 2, 3 1 0 0 represents -4 1 0 1 represents -3 1 1 0 represents -2 1 1 1 represents -1

47
Range for 2C Representation In general an N-bit register can represent binary numbers in the range - 2 N-1... + 2 N-1 - 1.

48
Binary Subtraction Example: Subtract 54 from 103 103 - 54 Can be written as 103 + (- 54) Step 1:Check how many bits you need Therefore we are going to use 8 bits in both cases. 1038 bits (range for +ve numbers is 0 …2 n-1 ) -547 bits (range for 2C numbers is 2 n-1 to + 2 n-1 -1)

49
Binary Subtraction Step 2: Convert - 54 to a 2C binary number -541 1 0 0 1 0 1 0 2 Step 3: Convert 103 to a binary number 1030 1 1 0 0 1 1 1 2 Step 4: Add binary 103 to - 54 0 1 1 0 0 1 1 1 2 + 1 1 0 0 1 0 1 0 2 1 0 0 1 1 0 0 0 1 2 Overflow bit The 9th bit or overflow bit will be ignored thus the 8-bit answer is correct. 0 0 1 1 0 0 0 1 2

50
Binary Multiplication Shifting the number left multiplies that number by 10 Decimal SystemBinary System Shifting the number left multiplies that number by 2 420 = 42 x 10. 111000 = 11100 x 2

Similar presentations

Presentation is loading. Please wait....

OK

CS2100 Computer Organisation

CS2100 Computer Organisation

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on immigration to canada Ppt on tata trucks Ppt on rational numbers for class 8th Ppt on manas national park Ppt online maker Ppt on places in our neighbourhood living Conceptual architecture view ppt on mac Display ppt online Free ppt on motivation for students Ppt on power grid failure east