Baixe o app para aproveitar ainda mais
Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original
* Number Systems Binary, Octal, Decimal, Hexadecimal Chaminade University Department of Computer Science Prof. Martins Computer Organization & Architecture Created by Authors Modified by P. Martins * * Number Systems A number system is a way of counting things. It's a way of identifying the quantity of something. * * The Decimal Number System Our counting system is based on the number 10 (10 fingers). The main principle of the decimal system is that 10 is considered as a new unit from which point counting starts again. Ten tens is again a new unit. The multiples of 10 are counted by the same systems as 1 to 9. * * The Decimal Number System 10 digits: 0 1 2 3 4 5 6 7 8 9 * * The Decimal Number System (132)10 = 100 + 30 + 2 = 1*102 + 3* 101 + 2 * 100 * * The Binary System “There are 10 types of people in the world: those who know binary and those who do not “ * * Power of the base * * The Binary System Two digits: 0, 1 (computers use transistors) Consists of two possible states such as On - Off, Yes - No, True - False, Zero - Non Zero. * * Counting from 0 to 15 Decimal Binary * * The Binary Number System (101)2 = 1 * 22 + 0 * 21 + 1*20 = 4 + 0 + 1 = (5) Conversão de binario para decimal * * The Octal Number System The octal, or base 8, number system is a common system used with computers. Because of its relationship with the binary system, it is useful in programming some types of computers. * * The Octal Number System Eight digits: 0,1,2,3,4,5,6,7 * * Counting from 0 to 15 Decimal Octal * * The Octal Number System (123)8 = 1 * 82 + 2 * 81 + 3 * 80 = 64 + 16 + 3 = 83 decimal Conversão octal para decimal * * Power of the base * * The Hexadecimal System 16 digits 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F * * Byte Representation A byte of memory can store a number in the range 00 to FF Hex * * Remarks A single hexadecimal number requires 4 units of binary numbers. This makes it reasonably easy to convert between these two numbering systems. E.g. 1 = 0001 9 = 0101 A = 1010 * * Counting from 0 to 15 decimal hexadecimal * * The Hexadecimal System (23A)16 = 2 * 162 + 3 * 161 + 10 * 160 = 2 * 256 + 48 + 10 = 512 + 48 + 10 = 512 + 58 = 570 Conversão para decimal * * Power of the base * * MSD and LSD When determining the most and least significant digits in an octal number, use the same rules that you used with the other number systems. The digit farthest to the left of the radix point is the MSD, and the one farthest right of the radix point is the LSD. * * Converting Decimal to Octal Convert 42710 to its Octal equivalent 427/8=> Q=53, R = 3 53/8 => Q=6, R = 5 6538 6/8 => Q=0, R = 6 Q = Quotient R = Remainder * * Converting Octal do Decimal Convert 6538 to its Decimal equivalent Octal Digits 6 5 3 x x x Positional Value 82 81 80 Sum over the product 384 + 40 + 3 42710 * * Converting Octal to Binary Convert 2678 to Binary 2 6 7 010 110 111 * * Converting Decimal to Hexa Convert 83010 to its Hex equivalent 830/16 q =51, r =14 51 /16 q =3, r =3 3/16 q =0, r=3 33E16 * * Converting Hex to Decimal Convert 3B4F16 to its Decimal equivalent Hex digits 3 B 4 F x x x x Positional Value 163 162 161 160 Product 12288 + 2816 + 64 + 15 15,18310 * * Converting Binary to Hex Convert 10010010011011102 to Hex 1001 0010 0110 1110 9 2 6 14 (E in Hex) 926E16 0000 = 0 0100 = 4 1000 = 8 1100 = 12 0001 = 1 0101 = 5 1001 = 9 1101 = 13 0010 = 2 0110 = 6 1010 = 10 1110 = 14 0011 = 3 0111 =7 1011 = 11 1111 = 15 * * Converting Hex to Octal Use an intermediate conversion step: Hex Binary Octal or Hex Decimal Octal Octal Binary Hex or Octal Decimal Hex * * Convert the following numbers (25)10 = ?2 (110101)2 = ?10 (13)10 = ?8 (43)16 = ?10 (96)10 = ?16 * * Answers 2510 = 110012 1101012 = 5310 1310 = 158 4316 = 6710 9610 = 6016 * * Summary Use “4 bit Substitution Code” for Hex Binary Use “3 bit Substitution Code” for Octal Binary * * Appendix - Fractions Converting binary fractions to decimal Converting decimal fractions to binary Converting hexadecimal fractions to decimal Converting decimal fractions to hexadecimal Converting hexadecimal fractions to binary * * Converting Fractional values Fractional values are represented with negative powers of the radix. Example: 1001.101 = 23 + 20 + 2-1 + 2-3 = (9.625)10 * * Converting binary fractions to decimal (10.011)2 = ( ? )10 (10)2 = (2)10 .011 = 0 * 2-1 + 1 * 2-2 + 1 * 2-3 = 0 + 1/4 + 1/8 = 0 + 0.25 + 0.125 = 0.375 Therefore (10.011)2 = (2.375)10 * * Converting decimal fractions to binary (3.1875)10 = ( ? )2 0.1875 * 2 = 0.3750 0.3750 * 2 = 0.7500 0.7500 * 2 = 1.5000 0.5000 * 2 = 1.0000 0.0000 * 2 = 0.0000 Therefore (3.1875)10 = (11.0011)2 * * Converting hexadecimal fractions to decimal (C.3)16 = ( ? )10 (C)16 = (12)10 (0.3)16 = ( ? )10 3 * 16-1 = 0.1875 Therefore, (C.3)16 = (12.1875)10 * * Converting decimal fractions to hexadecimal (15.125)10 = ( ? )16 (15)10 = (F)16 (0.125)10 = ( ? )16 but (0.125)10 = (.0010)2 = (.2)16 therefore, (15.125)10 = (F.2)16 * * Converting hexadecimal fractions to binary (F.C)16 = ( ? )2 (F)16 = (1111)2 (.C)16 = ( ? )2 but we know that (C)16 = (1100)2 Then (.C)16 = (.1100)2 Therefore, (F.C)16 = (1111.1100)2 * The PDP-8 minicomputers broke down instructions into four 3-bit words, using an octal digit to represent each 3-bit group * Note: you cannot convert 125 decimal to hexadecimal and use the result As the fractional part. That is only allowed in binary conversions. Multiply 0.125 x 2 = 0.250 > 0 0.250 x 2 = 0.500 > 0 0.500 x 2 = 1.000 > 1 0.000 x 2 = 0.000 > 0 therefore 0.125 decimal = .0010 binary = .2 hexa
Compartilhar