title: How does the bit layout of the floats give me certain values after bit shifting?
body: <p>Out of curiosity and wanting to learn more about floating point, I ran the following C code:</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
    float a = 1.0 + ((float) (1 &lt;&lt; 22));
    float b = 1.0 + ((float) (1 &lt;&lt; 23));
    float c = 1.0 + ((float) (1 &lt;&lt; 24));
  
    printf(&quot;a = %.6f\n&quot;, a);
    printf(&quot;b = %.6f\n&quot;, b);
    printf(&quot;c = %.6f&quot;, c);
  }
  </code></pre>
  <p>The results were:</p>
  <pre><code>a = 4194305.000000
  b = 8388609.000000
  c = 16777216.000000
  </code></pre>
  <p>I'm confused on why I got these results. Can anyone explain why the bit layout of a, b, and c causes each value to be what it is? I'm new to bit shifting and floats and a clear explanation would be greatly appreciated. Thank you.</p>