Hexadecimal: Difference between revisions

no edit summary
No edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 4:
 
== Uses ==
The hexadecimal number system is used widely in the Electronics and Computer Industry, as although digital electronics is based on gates with only two states and is therefore fundamentally binary, binary numbers can quickly become long and hard to transcribe without errors. Their hexadecimal equivalents are much shorter and easier to remember, and have a straight-forward way of conversion to/from binary.
 
=== Hex Dump ===
A textual representation of data where values are expressed in hexadecimal. Often used to show the contents of regions of memory where both the memory addresses as well as the memory contents may be expressed in hexadecimal.
 
== Comparing counts from zero in different number systems ==
C.f. [[Common number base conversionsformatting]] and [[Common number base parsing]]
Binary
Decimal
Line 51 ⟶ 50:
== Converting binary to hexadecimal ==
# Split a binary number into groups of four digits, counting from right to left.
# Pad the leftmost group of binary digits with zeros on their left if theirthere are less than four digits.
# Use the following table to translate each group of four binary digits, in order, to its hexadecimal equivalent.
Binary digits
Line 78 ⟶ 77:
Translate groups: 2 D 7
Hexadecimal answer: 2D7
 
== Hex words ==
It is common when working at the assembler level, and when designing digital hardware to arrange for self-checking tests to denote pass or failure by writing distinctive values to a memory location, or for un-initialised memory to be distinctive values. Many engineers use values whose value when expressed in a hex dump stands out as valid english words such as the values DEAD and BEEF.
 
A scan of the word list used in [[Anagrams]] leads to this list of four digit hexadecimal values that are also words:
<pre>aaa5 babe be1a b01d cede c0de dead d011 fa11 f0a1 1ead 1011 5ea1 50fa
abbe bade be11 b01e ce11 c0ed deaf d05e feed f01d 1eaf 105e 5eed 501d
abed ba1d be55 b010 c1ad c01a dea1 ea5e fee1 f00d 1e55 1055 5e1f 501e
abe1 ba1e b1ab b05e c10d c01d deed ee0c fe11 f001 10ad 0b0e 5e11 5010
ab1e ba11 b1ed b055 c0a1 c01e de11 e1ba f1ea f055 10af 01af 51ab
a1ba ba5e b10b cafe c0bb c001 d0dd e11a f1ed 1ace 10be 0510 51ed
a1ec ba55 b10c ca1f c0ca dada d0d0 e15e f1ee 1a05 10b0 5afe 510b
a10e bead b0ca ca11 c0c0 dade d0ff face f10c 1a5e 10eb 5a1e 510e
a150 beef b0de ca5e c0da da1e d01e fade f10e 1a55 101a 5cab 50da</pre>
 
== Data size limits ==
Numbers like 255, 65535, and 2,147,483,647 (I had to look this one up because I can't remember it off the top of my head, which just proves the following point) may seem arbitrary at first glance. But these are the "maximum" values for a reason. (2,147,483,647 is a little different because it's the maximum "positive" number where the other two examples are unsigned.)
 
<pre>
Decimal: 255
Binary: 11111111
Hex: FF
 
Decimal: 65535
Binary: 11111111 11111111
Hex: FFFF
 
 
Decimal: 2,147,483,647
Binary: 01111111 11111111 11111111 11111111
Hex: 7FFFFFFF
</pre>
 
It makes a little more sense now, doesn't it? For 255 and 65535, these are the highest possible values that can be represented with 8 and 16 bits, respectively. As for 2,147,483,647, it's just below halfway to the max. It's also as high as you can get without the leftmost binary digit equaling 1.
1,489

edits