1
$\begingroup$

Computer reads binary. Now my question is, what is the use of hexadecimal, octal and decimal? Do Computers understand or can read hexadecimal, octal and decimal? This question remains a mystery for me. Why memory locations use hexadecimal, it should be in binary right? Or is it because it is a binary and by time we read its memory location, the computer converts its memory location from binary into hexadecimal for us to make it readable?

$\endgroup$
  • $\begingroup$ The popular computers use binary, but you can also build computers that use other numbering system like decimal $\endgroup$ – adrianN Jun 12 '16 at 13:08
2
$\begingroup$

You got it in one. Hex is easier for humans to read but also trivial to convert to and from binary. The computer itself only uses binary, in the sense that every wire is either on or off. But, at the same time, you can look at the pattern of ons and offs on four adjacent wires and call that a hex digit.

$\endgroup$
1
$\begingroup$

Computers, on the lowest level read and manipulate binary representations. But this does not mean that they can't be programmed to manipulate octal,hex or even any other number base system. The choice of hexadecimal representation is taken because of human readability and ease of conversion.

Note that for a hexadecimal number, for example $7FC3$, in order to convert it to binary we need only take each hex digit and convert it to binary. Each hex digit (0-F) needs 4 binary digits to represent. $$7_{16} = (0111)_{2}$$ $$F_{16} = (1111)_{2}$$ $$C_{16} = (1100)_{2}$$ $$3_{16} = (0011)_{2}$$ This also works the other way round so its much easier for big binary numbers (that appear in memory addresses) to convert them into hex and manipulate them with this representations. If it was to convert them to decimal it would require more work (computing the corresponding polynomial) than this almost trivial algorithm.

$\endgroup$
1
$\begingroup$

You are confusing what is there, and how it is displayed. Memory contains bits, the bits are interpreted as integers, floating point numbers, pointers, characters whatever. And they are displayed by software in some way, whatever is most appropriate; in binary, hexadecimal, decimal, interpreted as characters and so on.

The computer doesn't convert anything when reading a memory location. It takes it as it is, and will interpret it according to what it thinks the data means. Conversion into hexadecimal only happens when you run software that is supposed to display memory contents as hexadecimal numbers, and is done by software running on the computer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.