INTRO TO COMP ENG CHAPTER V 1 CHAPTER V NUMBERS ARITHMETIC CHAPTER V NUMBER SYSTEMS AND ARITHMETIC R M Dansereau v 1 0 INTRO TO COMP ENG CHAPTER V 2 NUMBERS ARITHMETIC NUMBER SYSTEMS NUMBER SYSTEMS RADIX R REPRESENTATION Decimal number expansion 73625 10 7 10 4 3 10 3 6 10 2 2 10 1 5 10 0 Binary number representation 10110 2 1 2 4 0 2 3 1 2 2 1 2 1 0 2 0 22 10 Hexadecimal number representation 3E4B8 16 3 16 4 14 16 3 4 16 2 11 16 1 8 16 0 255160 10 R M Dansereau v 1 0 NUMBER SYSTEMS INTRO TO COMP ENG CHAPTER V 3 NUMBER SYSTEMS NUMBER REPRES DECIMAL REPRESENTATION NUMBERS ARITHMETIC Radix 10 Representation 73625 438510 10 5 10 4 10 3 10 2 10 1 10 0 0 7 3 6 2 5 10 1 10 2 10 3 10 4 10 5 4 3 8 5 0 73625 4385 10 7 10 4 3 10 3 6 10 2 2 10 1 5 10 0 4 10 1 3 10 2 8 10 3 5 10 4 R M Dansereau v 1 0 NUMBER SYSTEMS INTRO TO COMP ENG CHAPTER V 4 NUMBER SYSTEMS NUMBER REPRES DECIMAL REPRES BINARY REPRESENTATION NUMBERS ARITHMETIC Radix 2 Representation 10110 00112 25 24 23 22 21 20 0 1 0 1 1 0 MSB 2 1 2 2 2 3 2 4 2 5 0 0 1 1 0 LSB 10110 0011 2 1 2 4 0 2 3 1 2 2 1 2 1 0 2 0 0 2 1 0 2 2 1 2 3 1 2 4 22 1875 10 R M Dansereau v 1 0 NUMBER SYSTEMS INTRO TO COMP ENG CHAPTER V 5 NUMBER SYSTEMS NUMBER REPRES DECIMAL REPRES BINARY REPRES OCTAL REPRESENTATION NUMBERS ARITHMETIC Radix 8 Representation 26516 17318 85 84 83 82 81 80 0 2 6 5 1 6 8 1 8 2 8 3 8 4 8 5 1 7 3 1 0 26516 1731 8 2 8 4 6 8 3 5 8 2 1 8 1 6 8 0 1 8 1 7 8 2 3 8 3 1 8 4 11598 24 10 R M Dansereau v 1 0 NUMBER SYSTEMS INTRO TO COMP ENG CHAPTER V 6 NUMBER SYSTEMS DECIMAL REPRES BINARY REPRES OCTAL REPRES HEXADECIMAL REPRES NUMBERS ARITHMETIC Radix 16 Representation 19AD6 F41116 16 5 16 4 16 3 16 2 16 1 16 0 0 1 9 A D 6 16 1 16 2 16 3 16 4 16 5 F 4 1 1 0 19AD6 F411 16 1 16 4 9 16 3 A 16 2 D 16 1 6 16 0 F 16 1 4 16 2 1 16 3 1 16 4 105174 95 10 R M Dansereau v 1 0 INTRO TO COMP ENG CHAPTER V 7 NUMBERS ARITHMETIC NUMBER SYSTEMS BINARY HEXADECIMAL BINARY HEXADECIMAL 00002 016 00012 116 00102 216 00112 316 01002 416 01012 516 01102 616 01112 716 R M Dansereau v 1 0 10002 816 10012 916 10102 10 A16 10112 11 B16 11002 12 C16 11012 13 D16 11102 14 E16 11112 15 F16 NUMBER SYSTEMS BINARY REPRES OCTAL REPRES HEXADECIMAL REPRES BINARY HEXADECIMAL Group binary by 4 bits from radix point Examples 0111 10112 7B16 7 B 10 1010 0110 1100 012 2A6 C416 2 A 6 C 4 INTRO TO COMP ENG CHAPTER V 8 NUMBER SYSTEMS NUMBERS ARITHMETIC NUMBER SYSTEMS BINARY REPRES OCTAL REPRES BINARY HEXADECIMAL BINARY OCTAL BINARY OCTAL BINARY OCTAL Group binary bits by 3 from LSB 0002 08 0012 18 0102 28 0112 38 1002 48 1012 58 1102 68 1112 78 R M Dansereau v 1 0 Examples 10 100 1102 2468 2 4 6 10 101 111 011 011 112 2573 368 2 5 7 3 3 6 INTRO TO COMP ENG CHAPTER V 9 NUMBERS ARITHMETIC NUMBER SYSTEMS BINARY DECIMAL NUMBER SYSTEMS OCTAL REPRES BINARY HEXADECIMAL BINARY OCTAL Perform radix 2 expansion Multiply each bit in the binary number by 2 to the power of its place Then sum all of the values to get the decimal value Examples 10111 2 1 2 4 0 2 3 1 2 2 1 2 1 1 2 0 23 10 10110 0011 2 1 2 4 0 2 3 1 2 2 1 2 1 0 2 0 0 2 1 0 2 2 1 2 3 1 2 4 22 1875 10 R M Dansereau v 1 0 INTRO TO COMP ENG CHAPTER V 10 NUMBER SYSTEMS NUMBERS ARITHMETIC DECIMAL BINARY Integer part Example Modulo division of decimal integer by 2 to get each bit starting with LSB Fraction part Multiplication decimal fraction by 2 and collect resulting integers starting with MSB NUMBER SYSTEMS BINARY HEXADECIMAL BINARY OCTAL BINARY DECIMAL Convert 41 828125 10 41 20 10 5 2 1 mod mod mod mod mod mod 0 828125 2 0 65625 2 0 3125 2 0 625 2 0 25 2 0 5 2 2 2 2 2 2 2 1 0 0 1 0 1 LSB MSB 1 65625 1 3125 0 625 1 25 0 5 1 0 MSB LSB Therefore 41 828125 10 101001 110101 2 R M Dansereau v 1 0 NUMBER SYSTEMS INTRO TO COMP ENG CHAPTER V 11 FLOATING POINT NUMBERS NUMBERS ARITHMETIC NUMBER SYSTEMS BINARY HEXADECIMAL BINARY DECIMAL DECIMAL BINARY Floating point numbers can be represented with a sign bit a fraction often referred to as the mantissa and an exponent Example 1 267 426 0 267426 10 3 where the sign is negative the fraction is 0 267426 and the exponent is 3 Example 2 0101011 1001 0 1010111 2 6 where the sign is positive the fraction is 0 1010111 and the exponent is 0110 Sample IEEE Floating Point Formats 32 bit 64 bit R M Dansereau v 1 0 s e f 1 8 23 s e f 1 11 52 INTRO TO COMP ENG CHAPTER V 12 NUMBERS ARITHMETIC BINARY NUMBERS UNSIGNED INTEGER NUMBER SYSTEMS DECIMAL BINARY POWERS OF 2 FLOATING POINT The range for an n bit radix r unsigned integer is n 1 0 r 10 Example For a 16 bit binary unsigned integer the range is 0 2 16 1 0 65535 which has a binary representation of 0000 0000 0000 0000 0 0000 0000 0000 0001 1 0000 0000 0000 0010 2 1111 1111 1111 1110 65534 1111 1111 1111 1111 65535 R M Dansereau v 1 0 INTRO TO COMP ENG CHAPTER V 13 NUMBERS ARITHMETIC BINARY NUMBERS SIGNED INTEGERS 1 NUMBER SYSTEMS BINARY NUMBERS UNSIGNED INTEGERS The range for an n bit radix r signed integer is n 1 r n 1 1 r 10 10 The most significant bit is used as a sign bit where 0 indicates a positive integer and 1 indicates a negative integer Example For a 16 bit binary signed integer the range is 2 16 1 2 16 1 1 32768 32767 R M Dansereau v 1 0 INTRO TO COMP ENG CHAPTER V 14 NUMBERS ARITHMETIC BINARY NUMBERS SIGNED INTEGERS 2 …
View Full Document