mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-06 04:27:53 +02:00
82 lines
3.6 KiB
XML
82 lines
3.6 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
|
<style>
|
|
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
|
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
|
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
|
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
|
.dim{font:20px 'Courier New',monospace;fill:#888}
|
|
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
|
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
|
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
|
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
|
.badge{stroke:#00ff41;rx:14}
|
|
</style>
|
|
<rect class="bg" width="1200" height="800"/>
|
|
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
|
<text class="title" x="600" y="52" text-anchor="middle">IEEE-754 Floats</text>
|
|
<text class="dim" x="600" y="88" text-anchor="middle">How Computers Store Decimal Numbers</text>
|
|
|
|
<!-- Float Layout Diagram -->
|
|
<rect class="pnl" x="30" y="110" width="1140" height="190" rx="8"/>
|
|
<text class="sub" x="50" y="150">32-bit Float Structure</text>
|
|
|
|
<!-- Bit field boxes -->
|
|
<rect x="50" y="170" width="80" height="50" rx="4" fill="#ff0040" fill-opacity="0.2" stroke="#ff0040"/>
|
|
<text class="red" x="70" y="202">S</text>
|
|
<text class="dim" x="55" y="240">1 bit</text>
|
|
|
|
<rect x="150" y="170" width="320" height="50" rx="4" fill="#ffaa00" fill-opacity="0.2" stroke="#ffaa00"/>
|
|
<text class="amb" x="260" y="202">Exponent</text>
|
|
<text class="dim" x="270" y="240">8 bits</text>
|
|
|
|
<rect x="490" y="170" width="660" height="50" rx="4" fill="#00d4ff" fill-opacity="0.2" stroke="#00d4ff"/>
|
|
<text class="cyn" x="740" y="202">Mantissa (Fraction)</text>
|
|
<text class="dim" x="760" y="240">23 bits</text>
|
|
|
|
<text class="dim" x="50" y="280">Value = (-1)^S x (1 + Mantissa) x 2^(Exponent - 127)</text>
|
|
|
|
<!-- Example: Decoding 0.1f -->
|
|
<rect class="pnl" x="30" y="320" width="1140" height="220" rx="8"/>
|
|
<text class="sub" x="50" y="360">Example: Decoding 0.1f</text>
|
|
|
|
<text class="txt" x="50" y="400">Little-endian bytes:</text>
|
|
<text class="grn" x="380" y="400">cd cc cc 3d</text>
|
|
|
|
<text class="txt" x="50" y="435">Reversed (big-endian):</text>
|
|
<text class="grn" x="380" y="435">0x3dcccccd</text>
|
|
|
|
<text class="amb" x="50" y="475">Sign: 0</text>
|
|
<text class="amb" x="250" y="475">Exp: 01111011 = 123</text>
|
|
<text class="amb" x="580" y="475">Mantissa: 1001100...</text>
|
|
|
|
<text class="txt" x="50" y="510">Exp - 127 = -4, so value = 1.6 x 2^(-4)</text>
|
|
<text class="grn" x="680" y="510">= 0.1</text>
|
|
|
|
<!-- Float Reference Table -->
|
|
<rect class="pnl" x="30" y="560" width="1140" height="200" rx="8"/>
|
|
<text class="sub" x="50" y="600">IEEE-754 Quick Reference</text>
|
|
|
|
<text class="amb" x="50" y="635">Value</text>
|
|
<text class="amb" x="200" y="635">Hex</text>
|
|
<text class="amb" x="430" y="635">Bytes (LE)</text>
|
|
<line x1="50" y1="645" x2="1140" y2="645" stroke="#1a1a2e" stroke-width="1"/>
|
|
|
|
<text class="txt" x="50" y="675">0.1</text>
|
|
<text class="grn" x="200" y="675">0x3dcccccd</text>
|
|
<text class="dim" x="430" y="675">cd cc cc 3d</text>
|
|
<text class="txt" x="700" y="675">1.0</text>
|
|
<text class="grn" x="820" y="675">0x3f800000</text>
|
|
<text class="dim" x="1020" y="675">00 00 80 3f</text>
|
|
|
|
<text class="txt" x="50" y="710">5.0</text>
|
|
<text class="grn" x="200" y="710">0x40a00000</text>
|
|
<text class="dim" x="430" y="710">00 00 a0 40</text>
|
|
<text class="txt" x="700" y="710">10.0</text>
|
|
<text class="grn" x="820" y="710">0x41200000</text>
|
|
<text class="dim" x="1020" y="710">00 00 20 41</text>
|
|
|
|
<text class="txt" x="50" y="740">-1.0</text>
|
|
<text class="grn" x="200" y="740">0xbf800000</text>
|
|
<text class="dim" x="430" y="740">00 00 80 bf</text>
|
|
</svg>
|