The ability to represent information such as our number system in binary was an important milestone for sure. However, we quickly found out that working with binary is too difficult for us! We came up with an easier way for us humans to handle binary...
We came up with a new positional numeral system, called hexadecimal (hex in short), that is made up of sixteen digits:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
As with all the other number systems we talked about so far, every digit maps to a numerical value. This time round a digit represents a value between zero and fifteen.
Below is an example of a hex number.
Conversion from Binary to Hex
The conversions from binary to hex and vice-versa are very simple and straightforward (on purpose). We can convert a binary number to hex in just two steps:
Step One
Break the binary number into 4-bit sections starting from the Least Significant Bit (LSB) to the Most Significant Bit (MSB).
Step Two
Convert every 4-bit binary section to its hex equivalent.
Using the above you can probably reason out how to do the hex to binary conversion. Every single digit in a hex number represents a 4-bit binary section. So for each digit we just simply write the binary equivalent. That's it! Don't you think that working with hex is so much better than working with binary directly?
Conversion from Hex to Decimal and Vice Versa
It is important to point out that there isn't really a hex to decimal conversion. Hex is simply a shorter way of writing a binary number.
A hex number is a binary number
If someone asks you to convert hex to decimal then just remember to:
First, convert from hex to binary; and then
Convert binary numbers to decimal numbers and vice versa as in the previous chapter.
Do we really use this today?
Yes! Most common uses listed here briefly.
Website colour codes
Media Access Control addresses IP version 4 addresses
Define memory locations in the computer
System error memory dumps
Stuck on Mars by accident and all you have to communicate is a rotating probe with satellite connection... 😵
However to fully understand each one we just have to continue going through other topics. Piece by piece guys... it will come together in the end.
Comentários