Presentation is loading. Please wait.

Presentation is loading. Please wait.

Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.

Similar presentations


Presentation on theme: "Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary."— Presentation transcript:

1 Number Systems

2 Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary  The Hexadecimal Number System  (r-1)’s and r’s compliment

3 Number Systems The on and off states of the capacitors in RAM can be thought of as the values 1 and 0, respectively. Therefore, thinking about how information is stored in RAM requires knowledge of the binary (base 2) number system.

4 BINARY NUMBER SYSTEM 3/13/20164

5 The Binary Number System  The binary number system is also known as base 2. The values of the positions are calculated by taking 2 to some power.  Why is the base 2 for binary numbers? Because we use 2 digits, the digits 0 and 1.

6 The Binary Number System  The binary number system is also a positional numbering system.  Instead of using ten digits, 0 - 9, the binary system uses only two digits, 0 and 1.  Example of a binary number and the values of the positions:  1 0 0 1 1 0 1  2 6 2 5 2 4 2 3 2 2 2 1 2 0

7 Converting from Binary to Decimal  1 0 0 1 1 0 11 X 2 0 = 1  2 6 2 5 2 4 2 3 2 2 2 1 2 0 0 X 2 1 = 0  1 X 2 2 = 4  2 0 = 1 2 4 = 16 1 X 2 3 = 8  2 1 = 2 2 5 = 32 0 X 2 4 = 0  2 2 = 4 2 6 = 64 0 X 2 5 = 0  2 3 = 81 X 2 6 = 64 decimal=(77) 10

8 DECIMAL NUMBER SYSTEM

9 The Decimal Number System  The decimal number system is also known as base 10.  The values of the positions are calculated by taking 10 to some power.  Why is the base 10 for decimal numbers? Because we use 10 digits, the digits 0 through 9.

10 The Decimal Number System  The decimal number system is a positional number system.  Example: 42 10 = 1 0 1 0 1 0 2

11 The Decimal Number System

12 Converting From Decimal to Binary Make a list of the binary place values up to the number being converted. Perform successive divisions by 2, placing the remainder of 0 or 1 in each of the positions from right to left. Continue until the quotient is zero

13 OCTAL NUMBER SYSTEM 3/13/201613

14 Octal Number System (Base-8 ) The octal number system uses EIGHT values to represent numbers. The values are,0 1 2 3 4 5 6 7. 3/13/201614

15 Convert octal to decimal. Example: (264) 8 Each column represents a power of 8, 264 becomes..... 4 * 8 0 = 4 6 * 8 1 = 48 2 * 8 2 = 128 adding the results together gives 180 10 3/13/201615

16 DECIMAL TO OCTAL Example: convert (177) 10 to octal 177 / 8 = 22 remainder is 1 22 / 8 = 2 remainder is 6 2 / 8 = 0 remainder is 2 Answer = (2 6 1) 8 Note: the answer is read from bottom to top as (261) 8, the same as with the binary case. 3/13/201616

17 Working with Large Numbers 0 1 0 1 0 0 0 0 1 0 1 0 0 1 1 1 = ?  Humans can’t work well with binary numbers; there are too many digits to deal with.  Memory addresses and other data can be quite large. Therefore, we sometimes use the hexadecimal number system.

18 The Hexadecimal Number System The hexadecimal number system is also known as base 16. The values of the positions are calculated by taking 16 to some power. Why is the base 16 for hexadecimal numbers ? Because we use 16 symbols, the digits 0 through 9 and the letters A through F.

19 The Hexadecimal Number System Binary Decimal Hexadecimal 0 0 0 1010 10 A 1 1 1 1011 11 B 10 2 2 1100 12 C 11 3 3 1101 13 D 100 4 4 1110 14 E 101 5 5 1111 15 F 110 6 6 111 7 7 1000 8 8 1001 9 9

20 The Hexadecimal Number System Example of a hexadecimal number and the values of the positions:  3 C 8 B 0 5 1  16 6 16 5 16 4 16 3 16 2 16 1 16 0

21 Conversion of hex to decimal ( base 16 to base10) Example: convert (F4C) 16 to decimal =>(F x 16 2 ) + (4 x 16 1 ) + (C x 16 0 ) => (15 x 256) + (4 x 16) + (12 x 1) 3/13/201621

22 Conversion of decimal to hex ( base 10 to base 16) Example: convert (4768) 10 to hex. => 4768 / 16 = 298 remainder 0 =>298 / 16 = 18 remainder 10 (A) =>18 / 16 = 1 remainder 2 =>1 / 16 = 0 remainder 1 Answer: (1 2 A 0) 16 Note: the answer is read from bottom to top, same as with the binary case. 3/13/201622

23 Octal to hexadecimal conversion The conversion is made in two steps using binary as an intermediate base. Octal is converted to binary and then binary to hexadecimal, grouping digits by fours, which correspond each to a hexadecimal digit. For instance, convert (1057) 8 to hexadecimal: To binary : Then to hexadecimal: 3/13/201623 1057 001000101111 0010 1111 22F

24 REPRESENTATION OF NUMBERS

25 COMPLEMENT OF NUMBERS Two types of complements for base R number system: R's complement and (R-1)'s complement

26  The (R-1)'s Complement Subtract each digit of a number from (R-1) FOR DECIMAL NUMBERS (r-1)=9 and for binary numbers (r-1)=1 Example:  9's complement of 835 10 is 164 10  1's complement of 1010 2 is 0101 2 (bit by bit complement operation)  The (r – 1)’s complement of octal or hexadecimal numbers are obtained by subtracting each digit from 7 or F (decimal 15) respectively.

27 (r’s) Complement The r’s complement is obtained by adding 1 to the (r – 1)’s complement since r n – N = [(r n – 1) – N] + 1. Thus the 10’s complement of the decimal 2389 is 7610 + 1 = 7611 and is obtained by adding 1 to the 9’s complement value. The 2’s complement of binary 101100 is 010011 + 1 = 010100 and is obtained by adding 1 to the 1’s complement value. 3/13/201627

28 Add 1 to the low-order digit of its (R-1)'s complement Example - 10's complement of 835 10 is 164 10 + 1 = 165 10 - 2's complement of 1010 2 is 0101 2 + 1 = 0110 2


Download ppt "Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary."

Similar presentations


Ads by Google