<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yvette Lerma</title>
    <description>The latest articles on DEV Community by Yvette Lerma (@yvelerma).</description>
    <link>https://dev.to/yvelerma</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1260348%2F67f9eb0e-dd02-44eb-a2d4-3a3f3143d128.jpg</url>
      <title>DEV Community: Yvette Lerma</title>
      <link>https://dev.to/yvelerma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yvelerma"/>
    <language>en</language>
    <item>
      <title>Understanding Decimal to Binary Conversions: A Guide</title>
      <dc:creator>Yvette Lerma</dc:creator>
      <pubDate>Wed, 31 Jul 2024 20:00:26 +0000</pubDate>
      <link>https://dev.to/yvelerma/understanding-decimal-to-binary-conversions-a-guide-3ljb</link>
      <guid>https://dev.to/yvelerma/understanding-decimal-to-binary-conversions-a-guide-3ljb</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In the world of computing and digital electronics, binary numbers play a crucial role. While humans typically use the decimal system (base 10), computers operate using binary (base 2). Understanding how to convert between these systems is fundamental for anyone interested in computer science or electronics. IPv4 addresses are represented using the decimal base ten number system and the binary base 2 number system. In this blog post, we will delve into a step-by-step guide and practical examples to make the concept clear.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;What is Binary?&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Binary is a base-2 numeral system that uses only two digits: 0 and 1. Each digit in a binary number is called a bit. Computers use binary because it aligns well with their digital circuitry, which has two states: on (1) and off (0).&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Decimal to Binary Conversion Process&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Converting a decimal number to a binary number involves a basic understanding of &lt;code&gt;Decimal&lt;/code&gt; - base 10 numbering and &lt;code&gt;Binary&lt;/code&gt; - base 2 numbering.&lt;/p&gt;

&lt;p&gt;Consider, (figure 1)for place value notation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31lbbliciyamkl9soveo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31lbbliciyamkl9soveo.png" alt="Figure 1 - decimal-base" width="761" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;decimal numbering&lt;/code&gt; system we use 10 characters (0,1,2,3,4,5,6,7,8,9). The place values in the decimal number system are powers of 10. You could then replace any number in figure 1 with any number from 0-9 in the bottom row. &lt;br&gt;
Example: replacing 4 with 9, in figure 1, would then change the value, 9 x 100 = 900; changing the total to 3,968.&lt;/p&gt;

&lt;p&gt;In a &lt;code&gt;binary number&lt;/code&gt; system, consisting of 0s and 1s, place values function similarly to those in the &lt;code&gt;decimal system&lt;/code&gt; but are limited to 0 and 1. Let's look at binary number 11001001. (figure 2)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1bogb8x8sizuu4fahgwj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1bogb8x8sizuu4fahgwj.png" alt="Figure2-BinaryBase" width="764" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that you have a basic understanding of decimal and binary number systems, we can now look at conversions. In the example below(figure 3), we will be learning how to convert decimal number 168 to a binary number.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpm9961bnb59zdpgh2aoa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpm9961bnb59zdpgh2aoa.png" alt="Fig3-DecimaltoBinary" width="746" height="742"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is how:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Begin filling out '2 to the power of' and total of '2 to the power of', in a binary table. (see figure 2 or 3).&lt;/li&gt;
&lt;li&gt;Starting with 168, subtract the highest power of 2 less than or equal to the decimal number, which is 2^7 or 128.&lt;/li&gt;
&lt;li&gt;Put a 1 in that column if you can subtract that total power, and a 0 if you can't.&lt;/li&gt;
&lt;li&gt;168 - 128(2 to the power of 7) = 40; you would put a 1 in this column.(see figure 3)&lt;/li&gt;
&lt;li&gt;Taking the new total, 40. Repeat the steps again. 40 - 64 = No, so you would put a 0 in the (2 to the power of 6), column.&lt;/li&gt;
&lt;li&gt;40 - 32 = 8, 1 in this column.&lt;/li&gt;
&lt;li&gt;8 - 16 = No. 0 in this column.&lt;/li&gt;
&lt;li&gt;8 - 8 = 0. Yes, 1 in this column.&lt;/li&gt;
&lt;li&gt;0 - 4 = No(0). 0 - 2 = No(0). 0 - 1 = No(0).&lt;/li&gt;
&lt;li&gt;This will give you Binary number 10101000 for 168.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Why Binary is Important?&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Understanding binary is essential for several reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Computer Systems:&lt;/strong&gt; All computer operations are based on binary arithmetic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Digital Electronics:&lt;/strong&gt; Logic gates, which are the building blocks of digital circuits, operate using binary states.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Programming:&lt;/strong&gt; Knowledge of binary is crucial for low-level programming and debugging.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Networking:&lt;/strong&gt; IP addresses and subnet masks are often represented in binary.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Tips for Quick Conversions&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Memorize Powers of 2: Knowing that 2^0=1, 2^1=2, 2^2=4, etc., can speed up the conversion process.&lt;/li&gt;
&lt;li&gt;Use a Table: Create a table with columns for decimal numbers and their binary equivalents.&lt;/li&gt;
&lt;li&gt;Practice: Regular practice will improve speed and accuracy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Conclusion&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Converting decimal numbers to binary is a fundamental skill in computer science and digital electronics. By understanding the conversion process and practicing with examples, you can develop a strong foundation in binary arithmetic. Whether you're a student, a programmer, or an electronics enthusiast, mastering binary conversions will enhance your understanding of how computers and digital systems work.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Practice Problems&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Try converting the following decimal numbers to binary:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;27&lt;/li&gt;
&lt;li&gt;45&lt;/li&gt;
&lt;li&gt;63&lt;/li&gt;
&lt;li&gt;88&lt;/li&gt;
&lt;li&gt;102&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Check your answers in the &lt;strong&gt;comments&lt;/strong&gt; and see how well you understand the conversion process!&lt;/p&gt;

&lt;p&gt;(Some of the writing in this post was used from ChatGPT, as I get more practice writing -- ChatGPT will not be utilized.)&lt;/p&gt;

</description>
      <category>binary</category>
      <category>decimal</category>
      <category>conversions</category>
      <category>ipv4</category>
    </item>
  </channel>
</rss>
