Number Systems
2 The total number of allowable symbols in a number system is called the radix or base of the system. Decimal Numbers: radix = 10 (symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) Binary Numbers: radix = 2 (symbols: 0, 1) Hexadecimal Numbers: radix = 16 (symbols: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) Positional Notation: The radix point separates the integer part of the number from the fractional part of the number. Each position represents a power of the radix. Example: decimal number = (1 x 10 3 ) + (2 x 10 2 ) + (5 x 10 1 ) + (6 x 10 0 )+ (9 x ) + (3 x ) + (2 x ) Example: binary number ( ) 2 = (1 x 2 4 ) + (1 x 2 3 ) + (0 x 2 2 ) + (1 x 2 1 ) + (0 x 2 0 ) + (1 x 2 -1 ) + (1 x 2 -2 ) + (0 x 2 -3 ) + (1 x 2 -4 ) = = 26 13/16 Conversion Calculator
Number Systems3 Binary Numbers Assume 1-bit numbers: the largest number is binary 1 Only two different numbers can be represented: 0 AND 1 Assume 2-bit numbers: the largest number is binary 11 Four different numbers can be represented: (a) 00 – 0 (b) 01 – 1 (c)10 – 2 (d) Assume 3-bit numbers: the largest number is binary 111 Eight different numbers can be represented: 000 – – – – – – – – 7 What’s the largest number in binary that can be represented using 4 bits? What is it’s decimal equivalent?
Number Systems4 Hexadecimal Numbers Assume 4-bit binary numbers: Sixteen different numbers can be represented: Binary Decimal Hexadecimal A B C D E F Sample Hexadecimal Number: (A 1 F. 1 C) 16 = (A x 16 2 ) + (1 x 16 1 ) + (F x 16 0 ) + (1 x ) + (C x ) = (10 x 16 2 ) + (1 x 16 1 ) + (15 x 16 0 )+ (1 x ) + (12 x ) = /256
Number Systems5 Binary Hexadecimal Conversions Binary to Hex: group digits into blocks of 4 ( ) 2 = (?) = (4 2 A 5 6. F 1) 16 Hex to Binary: convert each hex value to binary (AF5.2C) 16 = (?) 2 A F 5. 2 C = ( ) 2 Another binary to hex: ( ) 2 = (?) = (1 A. D)16
Number Systems6 Radix Divide Techniques Decimal-to-Base x Integer Conversions Divide the given integer successively by the required radix, noting the remainder at each step. The quotient at each step becomes the new dividend for the subsequent division. Stop the division process when the quotient becomes zero. Collect the remainders from each step (last to first) and place them left to right to form the required number. Decimal-to-Binary Conversions: (245) 10 = (?) 2 Decimal-to-Hexadecimal Conversions: (245) 10 = (?) 16
Number Systems7 Radix Divide Techniques (245) 10 = (?) 2 = =1*2 7 +1*2 6 +1*2 5 +1* *2 3 +1*2 2 +0*2 1 +1*2 0 = = / / / / /271 7/231 3/211 1 /201 STOP
Number Systems8 Radix Divide Techniques (245) 10 = (?) 16 = F5 16 =15* *16 0 = / /16015 F STOP
Number Systems9 Summary of base conversions Base 2 to base 10 Multiply each binary digit by its power of 2 and add up the individual values Base 16 to base 10 Multiply each hex digit by its power of 16 and add up the individual values Base 10 to base 2: Use the division-remainder procedure with 2 as the divisor base 16: Use the division-remainder procedure with 16 as the divisor Base 2 to base 16 Convert each block of 4 binary digits into the equivalent base 16 value Base 16 to base 2 Expand each hex value into the equivalent binary