Presentation is loading. Please wait.

Presentation is loading. Please wait.

1/15/2015 Slide # 1 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Introduction to Binary, Octal and Hexadecimal Numbers Thaddeus Konar.

Similar presentations


Presentation on theme: "1/15/2015 Slide # 1 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Introduction to Binary, Octal and Hexadecimal Numbers Thaddeus Konar."— Presentation transcript:

1 1/15/2015 Slide # 1 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Introduction to Binary, Octal and Hexadecimal Numbers Thaddeus Konar

2 1/15/2015 Slide # 2 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Decimal Integers There is nothing ‘unique’ about number 10, but because we have 10 fingers, the decimal notation (from Latin decem and Greek Deka: 10) seems ‘natural’ to us. If the world would be like Simpsons (and I am glad it is not) the natural notation would be octal (8 fingers) 4576 78543 9654327 8374567301 8934098798347298763287632 09832198798237986498762380236409

3 1/15/2015 Slide # 3 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Decimal Integers Each digit (counting from the right) represents next power of ten, the rightmost digit represents 1s, next digit represents 10s, next 100s, and so on: …,10000, 1000, 100, 10, 1 which is the same as: …,10 4,10 3, 10 2, 10 1, 10 0 (Please remember that any number X to zero (0) power equals 1!) X 0 = 1

4 1/15/2015 Slide # 4 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Decimal Integers (cont) 7845 means: (5*1)+(4*10)+(8*100)+(7*1000) and this is same as: (5*10 0 )+(4*10 1 )+(8*10 2 )+(7*10 3 )

5 1/15/2015 Slide # 5 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Decimal Integers (Cont) What does 58345 ‘really’ mean: 58345 5 * 1 4 * 10 3 * 100 =5 =40 =300 8 * 1000=8000 5 * 10000 =50000 =58345

6 1/15/2015 Slide # 6 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Decimal Integers (cont) Lets look at the properties of the decimal integers: Base = 10 (1, 10, 100, …) (10 0, 10 1, 10 2, …) Digits range: 0 -> 9 (0,1,2,3,4,5,6,7,8,9) Number of values represented by a single digit: 10 Please note that number of digits equals Base, and range goes from zero to (Base –1). Digits range: 0 -> (Base - 1) Number of values represented by a single digit: Base

7 1/15/2015 Slide # 7 Binary, Octal and Hex Numbers Copyright Thaddeus Konar General Notation Any number is represented by combination of single digits D x, where x is the position of the digit counting from the right. The value of D x can be only the digits between (and including) 0 and (Base-1). …D 5 D 4 D 3 D 2 D 1 D 0 Using our example decimal number 7845 D 0 =5, D 1 =4, D 2 =8, and D 3 =7

8 1/15/2015 Slide # 8 Binary, Octal and Hex Numbers Copyright Thaddeus Konar General Notation (cont) We can see that any number really means: (D 0 *B 0 )+(D 1 *B 1 )+(D 2 *B 2 )+(D 3 *B 3 )+…(D n *B n ) In our example number 7845 (base 10) means: (5*10 0 )+(4*10 1 )+(8*10 2 )+(7*10 3 )=5+40+800+7000

9 1/15/2015 Slide # 9 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Binary Integers 1 Just as the each digit (position) in decimal integer is represented by the power of 10, binary integers are numbers where each digit is represented by the power of 2 (Base = 2). Digits range: 0 -> (Base - 1) Number of values represented by a single digit: Base Digits range: 0 -> 1(0,1) Number of values represented by a single digit: 2

10 1/15/2015 Slide # 10 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Binary Integers 2 In the decimal number the digits could be 0,1,2,3,4,5,6,7,8,9. (0 -> Base-1). As we can see the binary number digits could only be either 0 or 1 (0 ->Base-1). The single decimal number can represent 10 values, and the single binary number can represent only 2 values.

11 1/15/2015 Slide # 11 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Binary Integers 3 Binary integer will be a combination of 1s and 0s. Please recall the formula (and remember that now Base=2): (D 0 *B 0 )+(D 1 *B 1 )+(D 2 *B 2 )+(D 3 *B 3 )+…(D n *B n ) Lets look at the binary number 101110 D 0 =0, D 1 =1, D 2 =1, D 3 =1, D 4 =0, D 5 =1 B 0 =1, B 1 =2, B 2 =4, B 3 =8, B 4 =16, B 5 =32, B 6 =64…

12 1/15/2015 Slide # 12 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Binary Integers 4 Here are the first few binary numbers: …101110 means: (0*2 0 )+(1*2 1 )+(1*2 2 )+(1*2 3 )+(0*2 4 )+(1*2 5 ) = (0*1)+(1*2)+(1*4)+(1*8)+(0*16)+(1*32) = 46 10 0000 2 = 0 10 0100 2 = 4 10 1000 2 = 8 10 1100 2 = 12 10 10000 2 = 16 10 0001 2 = 1 10 0101 2 = 5 10 1001 2 = 9 10 1101 2 = 13 10 10001 2 = 17 10 0010 2 = 2 10 0110 2 = 6 10 1010 2 = 10 10 1110 2 = 14 10 10010 2 = 18 10 0011 2 = 3 10 0111 2 = 7 10 1011 2 = 11 10 1111 2 = 15 10 10011 2 = 19 10

13 1/15/2015 Slide # 13 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Binary Conversion Example Convert binary number 10111 to decimal: 10111 1 * 1 1 * 2 1 * 4 =1 =2 =4 0 * 8=0 1 * 16 =16 =23

14 1/15/2015 Slide # 14 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Convert binary number to decimal: 10111001 1 * 1 0 * 2 0 * 4 =1 =0 1 * 8=8 1 * 16 =16 =185 1 * 32=32 0 * 64=0 1 * 128=128

15 1/15/2015 Slide # 15 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Octal Integers 1 Just as the each digit (position) in decimal integer is represented by the power of 10, in binary integer each digit represents power of 2, in octal numbers each digit is represented by the power of 8 (Base = 8). Digits range: 0 -> (Base - 1) Number of values represented by a single digit: Base Digits range: 0 -> 7(0,1, 2, 3, 4, 5, 6, 7) Number of values represented by a single digit: 8

16 1/15/2015 Slide # 16 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Octal Integers 2 In the decimal number the digits could be 0,1,2,3,4,5,6,7,8,9. (0 -> Base-1), in binary 0,1 (Base-1), so as you can suspect in octal numbers the digits would be 0,1,2,3,4,5,6,7 (0 -> Base- 1). The single decimal number can represent 10 values, the single binary number can represent only 2 values, and single octal number can represent 8 values.

17 1/15/2015 Slide # 17 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Octal Integers 3 In octal integers Base = 8. Please recall the formula: (D 0 *B 0 )+(D 1 *B 1 )+(D 2 *B 2 )+(D 3 *B 3 )+…(D n *B n ) Lets look at the octal number 4153 D 0 =3, D 1 =5, D 2 =1, D 3 =4 B 0 =1, B 1 =8, B 2 =64, B 3 =512, B 4 =4096…

18 1/15/2015 Slide # 18 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Octal Integers 4 Here are the first few octal numbers: …4153 means: (3*8 0 )+(5*8 1 )+(1*8 2 )+(4*8 3 ) = (3*1)+(5*8)+(1*64)+(4*512) = 2155 10 0000 8 = 0 10 0004 8 = 4 10 0010 8 = 8 10 0014 8 = 12 10 0020 8 = 16 10 0001 8 = 1 10 0005 8 = 5 10 0011 8 = 9 10 0015 8 = 13 10 0021 8 = 17 10 0002 8 = 2 10 0006 8 = 6 10 0012 8 = 10 10 0016 8 = 14 10 0022 8 = 18 10 0003 8 = 3 10 0007 8 = 7 10 0013 8 = 11 10 0017 8 = 15 10 0023 8 = 19 10

19 1/15/2015 Slide # 19 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Hexadecimal (Hex) Integers 1 Just as the each digit (position) in decimal integer is represented by the power of 10, in binary integer - power of 2, in octal numbers - power of 8, and in hex integers – power of 16 (Base = 16). Digits range: 0 -> (Base - 1) Number of values represented by a single digit: Base Digits range: 0 -> 15 (0,1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F) Number of values represented by a single digit: 16

20 1/15/2015 Slide # 20 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Hex Integers 2 In the decimal number the digits could be 0,1,2,3,4,5,6,7,8,9. (0 -> Base-1), in binary 0,1 (Base-1), in octal 0,1,2,3,4,5,6,7. (0 -> Base-1). In hex numbers the digits would be 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F (0 -> Base-1). The letters A through F represent the decimal numbers 10 to 15. The single decimal number can represent 10 values, the single binary number can represent only 2 values, the single octal number can represent 8 values, and the single hex number can represent 16 values.

21 1/15/2015 Slide # 21 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Hex Integers 3 In Hex integers Base = 16. Please recall the formula: (D 0 *B 0 )+(D 1 *B 1 )+(D 2 *B 2 )+(D 3 *B 3 )+…(D n *B n ) Lets look at the octal number A59C D 0 =C, D 1 =9, D 2 =5, D 3 =A B 0 =1, B 1 =16, B 2 =256, B 3 =4096, B 4 =65536…

22 1/15/2015 Slide # 22 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Hex Integers 4 Here are the first few hex numbers: …A59C means: (12*16 0 )+(9*16 1 )+(5*16 2 )+(A*16 3 ) = (12*1)+(9*16)+(5*256)+(10*4096) = 42396 10 000 16 = 0 10 004 16 = 4 10 008 16 = 8 10 00C 16 = 12 10 010 16 = 16 10 001 16 = 1 10 005 16 = 5 10 009 16 = 9 10 00D 16 = 13 10 011 16 = 17 10 002 16 = 2 10 006 16 = 6 10 00A 16 = 10 10 00E 16 = 14 10 012 16 = 18 10 003 16 = 3 10 007 16 = 7 10 00B 16 = 11 10 00F 16 = 15 10 013 16 = 19 10

23 1/15/2015 Slide # 23 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Relationship between Binary and Octal Numbers 1011010 2 = 90 10 Converting to Octal: Binary: 001 011 010 = 90 10 Octal: 1 3 2 = 90 10 each octal digit is 3 bits

24 1/15/2015 Slide # 24 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Relationship between Binary and Hex Numbers 1011010 2 = 90 10 Converting to Hex: Binary: 0101 1010 = 90 10 Hex: 5 A = 90 10 each hex digit is 4 bits

25 1/15/2015 Slide # 25 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Relationship between Binary, Octal and Hex Numbers 1 111101101110010110101011010 2 Converting to Octal: 111 101 101 110 010 110 101 011 010 7 5 5 6 2 6 5 3 2 Converting to Hex: 0111 1011 0111 0010 1101 0101 1010 7 B 7 2 D 5 A

26 1/15/2015 Slide # 26 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Relationship between Binary, Octal and Hex Numbers 2 DecimalBinaryOctal (3 binary digits)Hex (4 binary digits) 00000000 10000111 20001022 30001133 40010044 50010155 60011066 70011177 801000108 901001119 100101012A 110101113B 120110014C 130110115D 140111016E 150111117F 16100002010 17100012111 18100102212 191001123 (10 + 011)13 (1 + 0011)

27 1/15/2015 Slide # 27 Binary, Octal and Hex Numbers Copyright Thaddeus Konar "nobody wants to be a 0 but everybody wants to be a 1" Laurie Anderson - Home of the Brave


Download ppt "1/15/2015 Slide # 1 Binary, Octal and Hex Numbers Copyright Thaddeus Konar Introduction to Binary, Octal and Hexadecimal Numbers Thaddeus Konar."

Similar presentations


Ads by Google