Commit 3152866b authored by John's avatar John

Site updated: 2018-11-05 04:25:12

parent 10fc1b33
......@@ -19,7 +19,7 @@
<meta property="og:description" content="Photo by Vidar Nordli-Mathisen on Unsplash Oh God. HEX! It’s just so hard to get your head around. A lot of people think that getting into…">
<meta property="og:locale" content="en">
<meta property="og:image" content="http://blog.thebestjohn.com/images/b4da55.png">
<meta property="og:updated_time" content="2018-11-05T02:42:23.211Z">
<meta property="og:updated_time" content="2018-11-05T04:23:49.334Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Base16 and all that Jazz">
<meta name="twitter:description" content="Photo by Vidar Nordli-Mathisen on Unsplash Oh God. HEX! It’s just so hard to get your head around. A lot of people think that getting into…">
......@@ -78,8 +78,8 @@
<div class="article__contents"><img src="/images/b4da55.png">
<h6 id="Photo-by-Vidar-Nordli-Mathisen-on-Unsplash"><a href="#Photo-by-Vidar-Nordli-Mathisen-on-Unsplash" class="headerlink" title="Photo by Vidar Nordli-Mathisen on Unsplash"></a>Photo by Vidar Nordli-Mathisen on Unsplash</h6>
<p>Oh God. HEX! It’s just so hard to get your head around. A lot of people think that getting into programming means they’re going to have to learn how to speak “computer” by learning binary and write programs with it. When you get into it, there
are very few times that you’ll actually need to use binary for every day tasks. Much more common however is Hexidecimal or Base16.</p>
<p>I’m going to try to give you a rundown on Hexidecimal and while I’m at it, I’ll swing back around to binary with what we’ve learned with Hex.</p>
are very few times that you’ll actually need to use binary for every day tasks. Much more common however is Hexadecimal or Base16.</p>
<p>I’m going to try to give you a rundown on Hexadecimal and while I’m at it, I’ll swing back around to binary with what we’ve learned with Hex.</p>
<h2 id="What-we-know-now"><a href="#What-we-know-now" class="headerlink" title="What we know now."></a>What we know now.</h2>
<p>Our common numbering system that we use day to day is actually called base10 or Decimal. Each digit has 10 positions, zero to nine. if I post up a number like 38 the number in the right most is 8 which means there are, well, 8 in the “ones”
location. “Ones” is not a good thing to call this, because, as we’ll learn, that can change. It’s more accurate to call this the least significant digit or LSD for short. That means it’s the position that affects the overall number the least.
......@@ -87,14 +87,14 @@
<p>So <code>8</code> means <code>8</code> but the <code>3</code> means there are <code>30</code>. In English, we call this Thirty Eight but in a lot of other languages it’s called Thirty and Eight. This is the mindset you want to get into. Don’t
think of numbers as individual values, rather think of them as a combinations of digit values. In base 10, each digit above the LSD is a value of <code>10</code> of the digit immediately preceding it. <code>10</code> is worth <code>10</code> <code>1</code>s,
<code>30</code> is 3 times <code>10</code> <code>1</code>s, and <code>100</code> is worth <code>10</code>, <code>10</code>s. The <code>10</code> is what’s important in base10. It informs when the number rolls over into the next digit.</p>
<h2 id="Hexidecimal"><a href="#Hexidecimal" class="headerlink" title="Hexidecimal"></a>Hexidecimal</h2>
<p>Hexidecimal is also known as base16. In Hex, <code>1</code> equals <code>1</code> in base10, our well known number system. In fact 0-9 is the same in Hex and Decimal. but those are the only numbers that are the same. For instance. <code>10</code> in Hexidecimal is actually <code>16</code> in base10. But how does this happen? Well in Hexidecimal, there are single digit numbers that are higher than <code>9</code>. How though? You can’t just invent numbers like that. Well actually you
<h2 id="Hexadecimal"><a href="#Hexadecimal" class="headerlink" title="Hexadecimal"></a>Hexadecimal</h2>
<p>Hexadecimal is also known as base16. In Hex, <code>1</code> equals <code>1</code> in base10, our well known number system. In fact 0-9 is the same in Hex and Decimal. but those are the only numbers that are the same. For instance. <code>10</code> in Hexadecimal is actually <code>16</code> in base10. But how does this happen? Well in Hexadecimal, there are single digit numbers that are higher than <code>9</code>. How though? You can’t just invent numbers like that. Well actually you
can. Base10 is just a way to record numbers. There’s no reason we couldn’t record numbers another way. Math gets different in different numbering systems but we’re not too worried about that, we just want to be able to record the same information
in less space. Hexidecimal’s LSD is recorded 0-15 like so.</p>
in less space. Hexadecimal’s LSD is recorded 0-15 like so.</p>
<table>
<thead>
<tr>
<th>Hexidecimal</th>
<th>Hexadecimal</th>
<th>0</th>
<th>1</th>
<th>2</th>
......@@ -140,12 +140,12 @@
<p>Now we get to the last part you have to understand about base16. Remember how we said that <code>100</code> is <code>10</code> <code>10</code>s? Well in base 16, <code>100</code> is <code>16</code> <code>16</code>s. So in this example, <code>FF + 1 = 100</code> and <code>100</code> in hex is <code>256</code>. This is the basics of every numbering system. the <code>base</code> part of base16 means how many positions the LSD can be in before overflowing into the next digit. Binary is no different.
Binary is also called base2. <code>0</code> and <code>1</code>.</p>
<h2 id="Binary"><a href="#Binary" class="headerlink" title="Binary"></a>Binary</h2>
<p>Knowing what we know in Hexidecimal, Binary should be more approachable. We don’t need to make up new digits because <code>0</code> and <code>1</code> already exist.</p>
<p>Knowing what we know in Hexadecimal, Binary should be more approachable. We don’t need to make up new digits because <code>0</code> and <code>1</code> already exist.</p>
<p>take a look at this.</p>
<table>
<thead>
<tr>
<th style="text-align:center">Hexidecimal</th>
<th style="text-align:center">Hexadecimal</th>
<th style="text-align:center">0</th>
<th style="text-align:center">1</th>
<th style="text-align:center">2</th>
......@@ -205,7 +205,7 @@
</tr>
</tbody>
</table>
<p>For a large margin all you’ll need to know about Hexidecimal will be 2 digits. <code>FF</code> is usually the max number you’ll encounter because it just so happens to be a full byte of data. a byte is 8 bits. A bit is a single digit of a
<p>For a large margin all you’ll need to know about Hexadecimal will be 2 digits. <code>FF</code> is usually the max number you’ll encounter because it just so happens to be a full byte of data. a byte is 8 bits. A bit is a single digit of a
binary number.</p>
<p><code>FF == 255 == 11111111</code></p>
<h2 id="Lessons"><a href="#Lessons" class="headerlink" title="Lessons"></a>Lessons</h2>
......@@ -238,7 +238,7 @@
})();
</script><noscript>Enable JavaScript to see comments.</noscript>
<!-- Meta Tags for Structured Data-->
<meta itemprop="dateModified" content="2018-11-05T02:42:23.211Z">
<meta itemprop="dateModified" content="2018-11-05T04:23:49.334Z">
<meta itemprop="articleBody" content="Photo by Vidar Nordli-Mathisen on Unsplash
Oh God. HEX! It’s just so hard to get your head around. A lot of people think that getting into programming means they’re going to have to learn how to...">
<meta itemprop="url" content="/posts/base16-and-all-that-jazz/">
......
......@@ -4,7 +4,7 @@
<url>
<loc>http://blog.thebestjohn.com/posts/base16-and-all-that-jazz/</loc>
<lastmod>2018-11-05T02:42:23.211Z</lastmod>
<lastmod>2018-11-05T04:23:49.334Z</lastmod>
</url>
......@@ -23,7 +23,7 @@
</url>
<url>
<loc>http://blog.thebestjohn.com/posts/matrix-keypad/</loc>
<loc>http://blog.thebestjohn.com/posts/sonoff-micropython-wonderland/</loc>
<lastmod>2018-11-03T23:30:58.784Z</lastmod>
......@@ -44,7 +44,7 @@
</url>
<url>
<loc>http://blog.thebestjohn.com/posts/sonoff-micropython-wonderland/</loc>
<loc>http://blog.thebestjohn.com/posts/matrix-keypad/</loc>
<lastmod>2018-11-03T23:30:58.784Z</lastmod>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment