Hexadecimal numbers Flashcards
How many different digits does hexadecimal use?
16
What does a single hex character represent?
- can represent any denary number from 0-15
- to represent 0-15 in binary it would require a nibble so each hex character equates to a nibble in binary.
Why do programmers prefer hex when coding?
- simpler to remember large numbers in hex, far shorter than binary numbers
- due to them being shorter, less chance of input errors
- easier to convert between denary and hex than binary and denary
In hex what do place values increase by?
Powers of 16
How to convert from hex to denary?
multiply the numbers in each column then add them.
How to convert from denary to hex?
Divide the numbers in each column then divide the remainder in the next column then put them together.
e.g. 106:
106/16 = 6 r 10
10/1 = 10 = A
== 6A
What does hex go up in?
0-9 then A-F
How can you convert from binary to hex?
- using nibbles as each hex character is equal to 1 nibble
Why is binary to hex conversions much easier than denary to hex?
You only have to deal with the nibbles one at a time.
An example of splitting the binary number 10111001 to hexadecimal:
1) split into nibbles: 1011 and 1001
2) Draw a table with columns 1,2,4,8 then repeat for how many nibbles you require.
3) Fill in table with binary number
4) For each nibble add up the numbers with a 1 in the column 8+2+1 and 9+1
5) convert to hexadecimal then put them together. In this case == B9
What do you do if the binary number can’t be split into nibbles?
Add some 0s onto the front.
How do you convert from hex to binary?
Convert each hex character into binary then just put them together.
Example: Convert the hexadecimal number 8C to binary:
1) First find the denary value of each character 8 = 8 in denary and C = 12 in denary
2) Find the binary value of each denary number 8 = 1000 in binary and 12 = 1100 in binary
3) Put nibbles together 10001100