Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11...

10
Hexadecimal

Transcript of Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11...

Page 1: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

Hexadecimal

Page 2: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

Overview

Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and ...

A = 10B = 11C = 12D = 13E = 14F = 15

Page 3: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

Decimal Example

2657 = 2000 + 600 + 50 + 7

= 2*1000 + 6*100 + 5*10 + 7*1

= 2*103 + 6*102 + 5*101 + 7*100

Page 4: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

Binary Example

10112 = 1*23 + 0*22 + 1*21 + 1*20

= 1*8 + 0*4 + 1*2 + 1*1

= 8 + 2 + 1 = 1110

Page 5: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

Hexadecimal Example

A4F16 = 10*162 + 4*161 + 15*160

= 10*256 + 4*16 + 15*1

= 2560 + 64 + 15 = 263910

Page 6: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

Hexadecimal Decimal

6116 = ?

F2316 = ?

Now convert the above to binary...

Page 7: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

Decimal Hexadecimal

1. Given the powers of 16: 1, 16, 256, 4096, etc.2. Find the power that is just bigger than your

number3. Go down to the next smallest power of 164. Divide your number by that power5. Round the result down6. Make note of the result for that power of 167. Multiply the rounded down result by its

corresponding power of 16…and then subtract that from your original number

8. Using the result from Step 7, repeat Steps 1-7 until you reach 0

Page 8: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

So why do we use hex?

Binary is annoying to read Hexadecimal is slightly easier Binary Hexadecimal is painless Example: 11101010100101012 = ?

Page 9: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

Binary Hexadecimal

1. Split the binary number up into 4-bit sections

2. Determine the hexadecimal value of each section

3. Bam…you’re done

Example: 111010010111010101000101

Page 10: Hexadecimal. Overview Hexadecimal (hex) ~ base 16 number system Use 0 through 9 and... A = 10 B = 11 C = 12 D = 13 E = 14 F = 15.

Hexadecimal Binary

1. Determine the 4-bit binary value for each hexadecimal digit

2. Bam…you’re done