<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Numeric-Systems on Jefferson Oliveira</title><link>https://jeffersonmourak.com/tags/numeric-systems/</link><description>Recent content in Numeric-Systems on Jefferson Oliveira</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>All content provided by this website are my own opinons and beliefs and are distrubuted under the &lt;br/></copyright><lastBuildDate>Sat, 14 Dec 2024 08:27:04 -0300</lastBuildDate><atom:link href="https://jeffersonmourak.com/tags/numeric-systems/index.xml" rel="self" type="application/rss+xml"/><item><title>Prazer, Binário.</title><link>https://jeffersonmourak.com/blog/the-binary/</link><pubDate>Sat, 14 Dec 2024 08:27:04 -0300</pubDate><guid>https://jeffersonmourak.com/blog/the-binary/</guid><category domain="https://jeffersonmourak.com/tags/cpu/">CPU</category><category domain="https://jeffersonmourak.com/tags/binary/">Binary</category><category domain="https://jeffersonmourak.com/tags/numeric-systems/">Numeric-Systems</category><category>Computação</category><category>Binário</category><description>&lt;blockquote>
&lt;p>Olá pessoas dessa internet, para quem está chegando aqui agora, este é o segundo artigo de
uma série que estou fazendo para falar sobre os fundamentos da computação, recomendo ler o
primeiro sobre &lt;a href="https://jeffersonmourak.com/blog/logic-gates/">portas lógicas&lt;/a>.
E para quem já leu o primeiro artigo, dá um pulinho lá porque eu fiz uma revisão no artigo, recomendo bastante dar uma olhada 😊&lt;/p>&lt;/blockquote>
&lt;p>Vamos nos aprofundar um pouco mais e explorar alguns conceitos de matemática e também da história humana.&lt;/p></description><content:encoded><![CDATA[<blockquote>
<p>Olá pessoas dessa internet, para quem está chegando aqui agora, este é o segundo artigo de
uma série que estou fazendo para falar sobre os fundamentos da computação, recomendo ler o
primeiro sobre <a href="https://jeffersonmourak.com/blog/logic-gates/">portas lógicas</a>.
E para quem já leu o primeiro artigo, dá um pulinho lá porque eu fiz uma revisão no artigo, recomendo bastante dar uma olhada 😊</p></blockquote>
<p>Vamos nos aprofundar um pouco mais e explorar alguns conceitos de matemática e também da história humana.</p>
<p>A matemática veio da necessidade de contar e medir da raça humana – quantos animais a Maria cuida, quantos dias até o próximo solstício&hellip; Com o tempo e a expansão humana, povos antigos criaram vários sistemas de numeração para o seu dia a dia. Jogos como <em>Grand Theft Auto V</em>, <em>Call of Duty: Black Ops III</em>, <em>Dragon Quest XI</em> são exemplos de uso do sistema numeral que os romanos usavam, e o <em>I Ching</em>, um antigo texto chinês, tem raízes em representações binárias.</p>
<p>Porém, não somente as antigas civilizações usavam outros sistemas numéricos. As horas de um dia são divididas entre 12 horas do período da manhã e 12 horas do período da tarde, ou uma dúzia de ovos. Na língua francesa ainda existem resquícios de um sistema com base vigesimal (20), por exemplo, o número 80 se diz <em>quatre-vingts</em> (quatro vintes), e um dos mais recentes é o Braille, que também tem raízes em representações binárias.</p>
<p>Nos dias atuais, utilizamos a representação decimal, e o motivo é bem simples: a média de dedos em mãos humanas são incríveis 10 dedos, sendo assim fica mais fácil contar usando somente as mãos.</p>
<h2 id="----">☝️ + ☝️ = ✌️</h2>
<p>Essa representação em base 10 é posicional, ou seja, a posição em que os dígitos são &ldquo;desenhados&rdquo; muda a quantidade que se está representando. <em>70</em> representa dez vezes mais que <em>07</em>, daí vem o ditado popular &ldquo;zero à esquerda&rdquo;. Na escola, aprendemos as casas decimais – <em>unidades</em>, <em>dezenas</em>, <em>centenas</em>&hellip; Elas servem para representar qual é a posição desse dígito.</p>
<table>
  <thead>
      <tr>
          <th style="text-align: center">Dezena</th>
          <th>Unidade</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td style="text-align: center">    7   </td>
          <td>0     </td>
      </tr>
      <tr>
          <td style="text-align: center">    0   </td>
          <td>7     </td>
      </tr>
  </tbody>
</table>
<p>E em cima dessa ordem existe uma fórmula matemática que converte um número de qualquer base para decimal. Para facilitar:</p>
<ul>
<li><strong>Dígito</strong>: Símbolo que representa uma quantidade única.
  <em>Ex.: 1, 2, 3, 4, 5, 6, 7, 8, 9, 0</em></li>
<li><strong>Número</strong>: Dígitos organizados em ordem de <em><strong>posição</strong></em>.
  <em>Ex.: 10, 144, 999, 42, 37, <code>0x8A6C</code>, <code>0b101010</code></em></li>
<li><strong>Base</strong>: Quantidade máxima de dígitos que pode ser representada.
  <em>Ex.: binário (<code>0b</code>) 2, decimal 10, hexadecimal (<code>0x</code>)</em></li>
<li><strong>Índice</strong>: A magnitude do dígito na posição.
  _Ex.: 10, o 1 em 10 tem <em>Índice 1</em> e o 0 tem <em>Índice 0</em> (é meio contraintuitivo, mas faz sentido).
  Em outras palavras, o índice é a posição da direita para a esquerda, começando em 0.</li>
</ul>
<p>A fórmula é bem simples: <em><strong>(d)ígito × (b)ase<sup>(i)ndice</sup></strong></em>. No exemplo que estamos fazendo, esta é a fórmula para converter 70 em decimal&hellip; para 70 em decimal. <strong>7 × 10<sup>1</sup> + 0 × 10<sup>0</sup> = 70</strong></p>
<p><em>Interactive binary counter widget (base 10, 3 digits) &mdash; <a href="https://jeffersonmourak.com/blog/the-binary/">view it on the blog</a>.</em></p>

<p>Quando falamos de números dessa forma, fica mais fácil representar o binário, que nada mais é que a quantidade que pode ser representada pela fórmula <em><strong>d × 2<sup>i</sup></strong></em>.</p>
<p><em>Interactive binary counter widget (base 2, 6 digits) &mdash; <a href="https://jeffersonmourak.com/blog/the-binary/">view it on the blog</a>.</em></p>

<p>E essa forma de representar quantidades também pode ser manipulada com operações matemáticas. A adição 25 + 17 é resolvida de modo parecido com isso.</p>
<pre tabindex="0"><code>1
2 5
1 7
--- +
4 2
</code></pre><p>No exemplo acima, temos alguns elementos que precisam ser destacados:</p>
<ol>
<li>Um <em>dígito</em> só pode ser somado com outro <em>dígito</em> que estiver no mesmo <em>índice</em>.</li>
<li>Quando a soma não puder ser representada com apenas um dígito, o menor índice é mantido como <em>resultado</em>, e o <em>resto</em> é enviado para o próximo índice.</li>
<li>O <em>resultado</em> de uma soma será sempre a soma dos <em><strong>dígitos</strong></em> do <em><strong>índice</strong></em> + o <em><strong>resto</strong></em> que veio do <em><strong>dígito</strong></em> no <em><strong>índice</strong></em> anterior.</li>
</ol>
<p>Com esses mesmos passos, podemos aplicar a soma em qualquer base.</p>
<pre tabindex="0"><code>    1 1 1       |  1      |  
1 0 0 0 1 1     |  2 5    |  1 9
0 0 0 1 1 1     |  1 7    |  1 1
------------ +  |  --- +  |  --- +
1 0 1 0 1 0     |  4 2    |  2 A 
</code></pre><figure>
  <img src="./hand.jpeg" alt="Cálculo de 25 &#43; 17 em bases Binária, Decimal e Hexadecimal" loading="lazy">
  <figcaption>Cálculo de 25 + 17 em bases Binária, Decimal e Hexadecimal</figcaption>
</figure><p><em>Interactive binary counter widget (base 2, 6 digits) &mdash; <a href="https://jeffersonmourak.com/blog/the-binary/">view it on the blog</a>.</em></p>

<p>Agora que já nos conhecemos, como podemos fazer para o computador nos conhecer também?</p>
<h2 id="brincando-de-tradução">Brincando de tradução</h2>
<p>Lembrando do <a href="https://jeffersonmourak.com/blog/logic-gates/">artigo anterior</a>, vamos isolar a soma de dois dígitos em tabelas. A primeira, vamos olhar para o resultado apenas. Temos esta tabela que se assemelha muito com a tabela da porta OR, exceto por essa pequena mudança no final.</p>
<div style="display: flex; gap: 16px;">
<span>
<table>
<tr><td colspan="3">Resultado</td></tr>
<tr>
 <td>?</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>0</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>1</td>
 <td>1</td>
 <td>0</td>
</tr>
</table>
</span>
<span>
<table>
<tr><td colspan="3">OR</td></tr>
<tr>
 <td>∨</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>0</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>1</td>
 <td>1</td>
 <td>1</td>
</tr>
</table>
</span>
</div>
<p>Para isso, podemos combinar o resultado das portas que já vimos anteriormente em um só circuito chamado &ldquo;OU Exclusivo&rdquo; ou &ldquo;XOR&rdquo;.</p>
<p><em>Interactive circ widget &mdash; <a href="https://jeffersonmourak.com/blog/the-binary/">view it on the blog</a>.</em></p>
<pre><code>╭───╮     ╭─────────────╮     ╭───╮     ╭───╮
│ a ├○●●─▶┤             │╭───▶┤   │ ╭──▶┤LED│
╰───╯ ││  │[nand:_nand_]├○╮   │AND├○╯   ╰───╯
      │●─▶┤             ││╰──▶┤   │          
      ││  ╰─────────────╯│    ╰───╯          
      ││                 │                   
╭───╮ ││  ╭─────────╮    │                   
│ b ├○●╰─▶┤         │    │                   
╰───╯ │   │[or:_or_]├○───╯                   
      ╰──▶┤         │                        
          ╰─────────╯                        </code></pre>
<p>Agora, vamos olhar também para a tabela do resto da nossa soma e se percebe que é uma cópia exata da porta AND.</p>
<div style="display: flex; gap: 16px;">
<span>
<table>
<tr><td colspan="3">Resto</td></tr>
<tr>
 <td>?</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>0</td>
 <td>0</td>
 <td>0</td>
</tr>
<tr>
 <td>1</td>
 <td>0</td>
 <td>1</td>
</tr>
</table>
</span>
<span>
<table>
<tr><td colspan="3">AND</td></tr>
<tr>
 <td>∧</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>0</td>
 <td>0</td>
 <td>0</td>
</tr>
<tr>
 <td>1</td>
 <td>0</td>
 <td>1</td>
</tr>
</table>
</span>
</div>
<p>E assim como o Capitão Planeta, &ldquo;Pela união dos seus poderes&rdquo;, nós vamos conseguir fazer a operação de soma de dois dígitos em binário, e esse componente é chamado de &ldquo;Somador&rdquo; ou &ldquo;Adder&rdquo;.</p>
<p><em>Interactive circ widget &mdash; <a href="https://jeffersonmourak.com/blog/the-binary/">view it on the blog</a>.</em></p>
<pre><code>╭───╮        ╭───╮               ╭───╮               ╭─────────╮     ╭───╮
│ a ├○●●────▶┤   │           ╭──▶┤   │ ╭────────────▶┤         │ ╭──▶┤LED│
╰───╯ ││     │AND├○╮         │   │AND├○╯             │[or:_or_]├○╯   ╰───╯
      │●────▶┤   │ │         │ ╭▶┤   │             ╭▶┤         │          
      ││     ╰───╯ │         │ │ ╰───╯             │ ╰─────────╯          
      ││           ╰─────────┼─┼───────────────────╯                      
╭───╮ ││     ╭─────────────╮ │ │ ╭─────────────╮                     ╭───╮
│ b ├○●╰────▶┤             │ ●─┼▶┤             │ ╭──────────────────▶┤LED│
╰───╯ │      │[xor:_xor_1_]├○● │ │[xor:_xor_2_]├○╯                   ╰───╯
      ╰─────▶┤             │   ●▶┤             │                          
             ╰─────────────╯   │ ╰─────────────╯                          
                               │                                          
╭──────╮                       │                                          
│ c_in ├○──────────────────────●                                          
╰──────╯                                                                  </code></pre>
<p>Com essa combinação de portas lógicas, um computador já consegue fazer as incríveis somas de: <code>0 + 0</code>, <code>1 + 0</code>, <code>0 + 1</code>, <code>1 + 1</code>, mas, além disso, ele consegue também dizer quanto que houve de resto da soma. E quando combinados vários ADDERs, a gente consegue fazer uma soma de números mais complexos como o 42, mas essa nós vamos ver no próximo artigo.</p>
<p>Por hoje é só isso, pessoal.</p>
<figure>
  <img src="https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExaXg4ZHNiMjVkMG1nY3M3NjRhaDI5cmFoNWtmaHVxNDBweGV5ZjdwOCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xUPOqo6E1XvWXwlCyQ/giphy.gif" alt="Isso é tudo pessoal!" loading="lazy">
  <figcaption>Isso é tudo pessoal!</figcaption>
</figure><h2 id="referências">Referências</h2>
<ul>
<li><a href="https://pt.wikipedia.org/wiki/%C3%81lgebra_booliana">A brief history of numerical systems (Youtube)</a></li>
<li><a href="https://en.wikipedia.org/wiki/Numeral_system">Numeral system (Wikipédia)</a></li>
<li><a href="https://pt.wikipedia.org/wiki/Sistema_de_numera%C3%A7%C3%A3o">Sistema de numeração (Wikipédia)</a></li>
<li><a href="https://www.youtube.com/watch?v=QZwneRb-zqA">Exploring How Computers Work (YouTube)</a></li>
<li><a href="https://www.youtube.com/watch?v=sTu3LwpF6XI">Making logic gates from transistors (YouTube)</a></li>
<li><a href="https://www.youtube.com/watch?v=HjneAhCy2N4">HOW TRANSISTORS RUN CODE? (YouTube)</a></li>
<li><a href="https://www.nand2tetris.org/">From Nand to Tetris</a></li>
</ul>
]]></content:encoded></item><item><title>Pleasure to meet you, Binary.</title><link>https://jeffersonmourak.com/blog/the-binary-en/</link><pubDate>Sat, 14 Dec 2024 08:27:04 -0200</pubDate><guid>https://jeffersonmourak.com/blog/the-binary-en/</guid><category domain="https://jeffersonmourak.com/tags/cpu/">CPU</category><category domain="https://jeffersonmourak.com/tags/binary/">Binary</category><category domain="https://jeffersonmourak.com/tags/numeric-systems/">Numeric-Systems</category><category>Computing</category><description>&lt;blockquote>
&lt;p>Hey Y&amp;rsquo;all! This is a translation of my blog post originally written in Portuguese.&lt;/p>&lt;/blockquote>
&lt;blockquote>
&lt;p>Hello people of this internet, for those who are arriving here now, this is the second article of
a series I&amp;rsquo;m doing to talk about the fundamentals of computing, I recommend reading the
first one about &lt;a href="https://jeffersonmourak.com/blog/logic-gates/">logic gates&lt;/a>.
And for those who have already read the first article, take a quick look there because I did a revision of the article, I highly recommend taking a look 😊&lt;/p></description><content:encoded><![CDATA[<blockquote>
<p>Hey Y&rsquo;all! This is a translation of my blog post originally written in Portuguese.</p></blockquote>
<blockquote>
<p>Hello people of this internet, for those who are arriving here now, this is the second article of
a series I&rsquo;m doing to talk about the fundamentals of computing, I recommend reading the
first one about <a href="https://jeffersonmourak.com/blog/logic-gates/">logic gates</a>.
And for those who have already read the first article, take a quick look there because I did a revision of the article, I highly recommend taking a look 😊</p></blockquote>
<p>Let&rsquo;s dive a bit deeper and explore some concepts of mathematics and also human history.</p>
<p>Mathematics came from the human race&rsquo;s need to count and measure – how many animals Maria takes care of, how many days until the next solstice&hellip; Over time and human expansion, ancient peoples created various numbering systems for their daily lives. Games like <em>Grand Theft Auto V</em>, <em>Call of Duty: Black Ops III</em>, <em>Dragon Quest XI</em> are examples of using the numeral system that the Romans used, and the <em>I Ching</em>, an ancient Chinese text, has roots in binary representations.</p>
<p>However, not only ancient civilizations used other numerical systems. The hours of a day are divided between 12 hours of the morning period and 12 hours of the afternoon period, or a dozen eggs. In the French language, there are still remnants of a vigesimal-based system (20), for example, the number 80 is said as <em>quatre-vingts</em> (four twenties), and one of the most recent is Braille, which also has roots in binary representations.</p>
<p>Nowadays, we use decimal representation, and the reason is quite simple: the average number of fingers on human hands is an incredible 10 fingers, so it&rsquo;s easier to count using only hands.</p>
<h2 id="----">☝️ + ☝️ = ✌️</h2>
<p>This base 10 representation is positional, meaning the position in which the digits are &ldquo;drawn&rdquo; changes the quantity being represented. <em>70</em> represents ten times more than <em>07</em>, hence the popular saying &ldquo;zero to the left&rdquo;. In school, we learn about decimal places – <em>units</em>, <em>tens</em>, <em>hundreds</em>&hellip; They serve to represent what the position of that digit is.</p>
<table>
  <thead>
      <tr>
          <th style="text-align: center">Tens</th>
          <th>Units</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td style="text-align: center">7</td>
          <td>0</td>
      </tr>
      <tr>
          <td style="text-align: center">0</td>
          <td>7</td>
      </tr>
  </tbody>
</table>
<p>And on top of this order, there&rsquo;s a mathematical formula that converts a number from any base to decimal. To make it easier:</p>
<ul>
<li><strong>Digit</strong>: Symbol that represents a unique quantity.
<em>Ex.: 1, 2, 3, 4, 5, 6, 7, 8, 9, 0</em></li>
<li><strong>Number</strong>: Digits organized in order of <em><strong>position</strong></em>.
<em>Ex.: 10, 144, 999, 42, 37, <code>0x8A6C</code>, <code>0b101010</code></em></li>
<li><strong>Base</strong>: Maximum quantity of digits that can be represented.
<em>Ex.: binary (<code>0b</code>) 2, decimal 10, hexadecimal (<code>0x</code>)</em></li>
<li><strong>Index</strong>: The magnitude of the digit in the position.
_Ex.: 10, the 1 in 10 has <em>Index 1</em> and the 0 has <em>Index 0</em> (it&rsquo;s a bit counterintuitive, but it makes sense).
In other words, the index is the position from right to left, starting at 0.</li>
</ul>
<p>The formula is quite simple: <em><strong>(d)igit × (b)ase<sup>(i)ndex</sup></strong></em>. In the example we&rsquo;re doing, this is the formula to convert 70 to decimal&hellip; to 70 in decimal. <strong>7 × 10<sup>1</sup> + 0 × 10<sup>0</sup> = 70</strong></p>
<p><em>Interactive binary counter widget (base 10, 3 digits) &mdash; <a href="https://jeffersonmourak.com/blog/the-binary-en/">view it on the blog</a>.</em></p>

<p>When we talk about numbers this way, it becomes easier to represent binary, which is nothing more than the quantity that can be represented by the formula <em><strong>d × 2<sup>i</sup></strong></em>.</p>
<p><em>Interactive binary counter widget (base 2, 6 digits) &mdash; <a href="https://jeffersonmourak.com/blog/the-binary-en/">view it on the blog</a>.</em></p>

<p>And this way of representing quantities can also be manipulated with mathematical operations. The addition 25 + 17 is solved in a way similar to this.</p>
<pre tabindex="0"><code>1
2 5
1 7
--- +
4 2
</code></pre><p>In the example above, we have some elements that need to be highlighted:</p>
<ol>
<li>A <em>digit</em> can only be added to another <em>digit</em> that is in the same <em>index</em>.</li>
<li>When the sum cannot be represented with just one digit, the smallest index is kept as the <em>result</em>, and the <em>remainder</em> is sent to the next index.</li>
<li>The <em>result</em> of a sum will always be the sum of the <em><strong>digits</strong></em> of the <em><strong>index</strong></em> + the <em><strong>remainder</strong></em> that came from the <em><strong>digit</strong></em> in the previous <em><strong>index</strong></em>.</li>
</ol>
<p>With these same steps, we can apply addition in any base.</p>
<pre tabindex="0"><code>    1 1 1       |  1      |  
1 0 0 0 1 1     |  2 5    |  1 9
0 0 0 1 1 1     |  1 7    |  1 1
------------ +  |  --- +  |  --- +
1 0 1 0 1 0     |  4 2    |  2 A 
</code></pre><figure>
  <img src="./hand.jpeg" alt="Calculation of 25 &#43; 17 in Binary, Decimal and Hexadecimal bases" loading="lazy">
  <figcaption>Calculation of 25 + 17 in Binary, Decimal and Hexadecimal bases</figcaption>
</figure><p><em>Interactive binary counter widget (base 2, 6 digits) &mdash; <a href="https://jeffersonmourak.com/blog/the-binary-en/">view it on the blog</a>.</em></p>

<p>Now that we already know each other, how can we make the computer know us too?</p>
<h2 id="playing-with-translation">Playing with translation</h2>
<p>Remembering the <a href="https://jeffersonmourak.com/blog/logic-gates/">previous article</a>, let&rsquo;s isolate the addition of two digits in tables. First, let&rsquo;s look at just the result. We have this table that very much resembles the OR gate table, except for this small change at the end.</p>
<div style="display: flex; gap: 16px;">
<span>
<table>
<tr><td colspan="3">Result</td></tr>
<tr>
 <td>?</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>0</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>1</td>
 <td>1</td>
 <td>0</td>
</tr>
</table>
</span>
<span>
<table>
<tr><td colspan="3">OR</td></tr>
<tr>
 <td>∨</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>0</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>1</td>
 <td>1</td>
 <td>1</td>
</tr>
</table>
</span>
</div>
<p>For this, we can combine the results of the gates we saw earlier into a single circuit called &ldquo;Exclusive OR&rdquo; or &ldquo;XOR&rdquo;.</p>
<p><em>Interactive circ widget &mdash; <a href="https://jeffersonmourak.com/blog/the-binary-en/">view it on the blog</a>.</em></p>
<pre><code>╭───╮     ╭─────────────╮     ╭───╮     ╭───╮
│ a ├○●●─▶┤             │╭───▶┤   │ ╭──▶┤LED│
╰───╯ ││  │[nand:_nand_]├○╮   │AND├○╯   ╰───╯
      │●─▶┤             ││╰──▶┤   │          
      ││  ╰─────────────╯│    ╰───╯          
      ││                 │                   
╭───╮ ││  ╭─────────╮    │                   
│ b ├○●╰─▶┤         │    │                   
╰───╯ │   │[or:_or_]├○───╯                   
      ╰──▶┤         │                        
          ╰─────────╯                        </code></pre>
<p>Now, let&rsquo;s also look at the remainder table of our addition and you&rsquo;ll notice that it&rsquo;s an exact copy of the AND gate.</p>
<div style="display: flex; gap: 16px;">
<span>
<table>
<tr><td colspan="3">Remainder</td></tr>
<tr>
 <td>?</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>0</td>
 <td>0</td>
 <td>0</td>
</tr>
<tr>
 <td>1</td>
 <td>0</td>
 <td>1</td>
</tr>
</table>
</span>
<span>
<table>
<tr><td colspan="3">AND</td></tr>
<tr>
 <td>∧</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>0</td>
 <td>0</td>
 <td>0</td>
</tr>
<tr>
 <td>1</td>
 <td>0</td>
 <td>1</td>
</tr>
</table>
</span>
</div>
<p>And just like Captain Planet, &ldquo;By the union of their powers&rdquo;, we will be able to perform the operation of adding two digits in binary, and this component is called &ldquo;Adder&rdquo;.</p>
<p><em>Interactive circ widget &mdash; <a href="https://jeffersonmourak.com/blog/the-binary-en/">view it on the blog</a>.</em></p>
<pre><code>╭───╮        ╭───╮               ╭───╮               ╭─────────╮     ╭───╮
│ a ├○●●────▶┤   │           ╭──▶┤   │ ╭────────────▶┤         │ ╭──▶┤LED│
╰───╯ ││     │AND├○╮         │   │AND├○╯             │[or:_or_]├○╯   ╰───╯
      │●────▶┤   │ │         │ ╭▶┤   │             ╭▶┤         │          
      ││     ╰───╯ │         │ │ ╰───╯             │ ╰─────────╯          
      ││           ╰─────────┼─┼───────────────────╯                      
╭───╮ ││     ╭─────────────╮ │ │ ╭─────────────╮                     ╭───╮
│ b ├○●╰────▶┤             │ ●─┼▶┤             │ ╭──────────────────▶┤LED│
╰───╯ │      │[xor:_xor_1_]├○● │ │[xor:_xor_2_]├○╯                   ╰───╯
      ╰─────▶┤             │   ●▶┤             │                          
             ╰─────────────╯   │ ╰─────────────╯                          
                               │                                          
╭──────╮                       │                                          
│ c_in ├○──────────────────────●                                          
╰──────╯                                                                  </code></pre>
<p>With this combination of logic gates, a computer can already perform the incredible additions of: <code>0 + 0</code>, <code>1 + 0</code>, <code>0 + 1</code>, <code>1 + 1</code>, but beyond that, it can also say how much remainder there was from the addition. And when several ADDERs are combined, we can perform addition of more complex numbers like 42, but that we&rsquo;ll see in the next article.</p>
<p>That&rsquo;s all for today, folks.
<img src="https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExaXg4ZHNiMjVkMG1nY3M3NjRhaDI5cmFoNWtmaHVxNDBweGV5ZjdwOCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xUPOqo6E1XvWXwlCyQ/giphy.gif" alt="That&rsquo;s all folks!" loading="lazy"></p>
<h2 id="references">References</h2>
<ul>
<li><a href="https://pt.wikipedia.org/wiki/%C3%81lgebra_booliana">A brief history of numerical systems (Youtube)</a></li>
<li><a href="https://en.wikipedia.org/wiki/Numeral_system">Numeral system (Wikipédia)</a></li>
<li><a href="https://pt.wikipedia.org/wiki/Sistema_de_numera%C3%A7%C3%A3o">Sistema de numeração (Wikipédia)</a></li>
<li><a href="https://www.youtube.com/watch?v=QZwneRb-zqA">Exploring How Computers Work (YouTube)</a></li>
<li><a href="https://www.youtube.com/watch?v=sTu3LwpF6XI">Making logic gates from transistors (YouTube)</a></li>
<li><a href="https://www.youtube.com/watch?v=HjneAhCy2N4">HOW TRANSISTORS RUN CODE? (YouTube)</a></li>
<li><a href="https://www.nand2tetris.org/">From Nand to Tetris</a></li>
</ul>
]]></content:encoded></item></channel></rss>