mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-13 10:39:54 +08:00
deploy
This commit is contained in:
@@ -3603,7 +3603,7 @@
|
||||
<li><strong>One's complement</strong>: The one's complement of a positive number is the same as its sign-magnitude. For negative numbers, it's obtained by inverting all bits except the sign bit.</li>
|
||||
<li><strong>Two's complement</strong>: The two's complement of a positive number is the same as its sign-magnitude. For negative numbers, it's obtained by adding <span class="arithmatex">\(1\)</span> to their one's complement.</li>
|
||||
</ul>
|
||||
<p>The following diagram illustrates the conversions among sign-magnitude, one's complement, and two's complement:</p>
|
||||
<p>Figure 3-4 illustrates the conversions among sign-magnitude, one's complement, and two's complement:</p>
|
||||
<p><a class="glightbox" href="../number_encoding.assets/1s_2s_complement.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Conversions between sign-magnitude, one's complement, and two's complement" class="animation-figure" src="../number_encoding.assets/1s_2s_complement.png" /></a></p>
|
||||
<p align="center"> Figure 3-4 Conversions between sign-magnitude, one's complement, and two's complement </p>
|
||||
|
||||
@@ -3689,7 +3689,7 @@ b_{31} b_{30} b_{29} \ldots b_2 b_1 b_0
|
||||
<p><a class="glightbox" href="../number_encoding.assets/ieee_754_float.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Example calculation of a float in IEEE 754 standard" class="animation-figure" src="../number_encoding.assets/ieee_754_float.png" /></a></p>
|
||||
<p align="center"> Figure 3-5 Example calculation of a float in IEEE 754 standard </p>
|
||||
|
||||
<p>Observing the diagram, given an example data <span class="arithmatex">\(\mathrm{S} = 0\)</span>, <span class="arithmatex">\(\mathrm{E} = 124\)</span>, <span class="arithmatex">\(\mathrm{N} = 2^{-2} + 2^{-3} = 0.375\)</span>, we have:</p>
|
||||
<p>Observing Figure 3-5, given an example data <span class="arithmatex">\(\mathrm{S} = 0\)</span>, <span class="arithmatex">\(\mathrm{E} = 124\)</span>, <span class="arithmatex">\(\mathrm{N} = 2^{-2} + 2^{-3} = 0.375\)</span>, we have:</p>
|
||||
<div class="arithmatex">\[
|
||||
\text{val} = (-1)^0 \times 2^{124 - 127} \times (1 + 0.375) = 0.171875
|
||||
\]</div>
|
||||
|
||||
Reference in New Issue
Block a user