> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0907world.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 第 2 章 数据的机器级表示

这一章整理数据在计算机中的表示方法，包括浮点数、字符编码、常见容量单位，以及多字节数据在内存中的排列顺序

<AccordionGroup>
  <Accordion title="IEEE754">
    IEEE 754 用于描述浮点数在机器中的表示方式，复习时重点关注符号位、阶码和尾数的含义

    <img src="https://mintcdn.com/0907/yO7weug7l78KOEtX/images/computer-architecture/Chapter2_IEEE754_1.webp?fit=max&auto=format&n=yO7weug7l78KOEtX&q=85&s=32fe076215e3a8087f9e1366d05a114c" alt="IEEE 754 浮点数表示示意图 1" width="1128" height="348" data-path="images/computer-architecture/Chapter2_IEEE754_1.webp" />

    <img src="https://mintcdn.com/0907/yO7weug7l78KOEtX/images/computer-architecture/Chapter2_IEEE754_2.webp?fit=max&auto=format&n=yO7weug7l78KOEtX&q=85&s=36e996f314af4d50f965c64de12bbec7" alt="IEEE 754 浮点数表示示意图 2" width="1152" height="638" data-path="images/computer-architecture/Chapter2_IEEE754_2.webp" />
  </Accordion>

  <Accordion title="ASCII">
    <Info>
      ASCII = American Standard Code for Information Interchange
    </Info>

    ASCII 是字符在计算机中的基础编码方式，复习时可结合下图记忆字符与编码值的对应关系

    <img src="https://mintcdn.com/0907/yO7weug7l78KOEtX/images/computer-architecture/Chapter2_ASCII_1.webp?fit=max&auto=format&n=yO7weug7l78KOEtX&q=85&s=ac30e5f91153f15b76c25c4fb8bf3418" alt="ASCII 编码表图示 1" width="1154" height="712" data-path="images/computer-architecture/Chapter2_ASCII_1.webp" />

    <img src="https://mintcdn.com/0907/yO7weug7l78KOEtX/images/computer-architecture/Chapter2_ASCII_2.webp?fit=max&auto=format&n=yO7weug7l78KOEtX&q=85&s=41d9b74f75eb03bbdff7484fccd9f515" alt="ASCII 编码表图示 2" width="1154" height="836" data-path="images/computer-architecture/Chapter2_ASCII_2.webp" />
  </Accordion>

  <Accordion title="数据的宽度和存储">
    不同场景下，容量单位和传输单位的进制约定不同，需要区分记忆

    <Tip>
      主存容量通常按 $2$ 的幂记忆，带宽和传输速率通常按 $10$ 的幂记忆
    </Tip>

    <Tabs>
      <Tab title="主存容量">
        <table>
          <tbody>
            <tr><td>1 KB (kilobyte)</td><td>=</td><td>$2^{10}$ 字节</td></tr>
            <tr><td>1 MB (megabyte)</td><td>=</td><td>$2^{20}$ 字节</td></tr>
            <tr><td>1 GB (gigabyte)</td><td>=</td><td>$2^{30}$ 字节</td></tr>
            <tr><td>1 TB (terabyte)</td><td>=</td><td>$2^{40}$ 字节</td></tr>
            <tr><td>1 PB (petabyte)</td><td>=</td><td>$2^{50}$ 字节</td></tr>
            <tr><td>1 EB (exabyte)</td><td>=</td><td>$2^{60}$ 字节</td></tr>
            <tr><td>1 ZB (zettabyte)</td><td>=</td><td>$2^{70}$ 字节</td></tr>
            <tr><td>1 YB (yottabyte)</td><td>=</td><td>$2^{80}$ 字节</td></tr>
          </tbody>
        </table>
      </Tab>

      <Tab title="主频和带宽">
        <table>
          <tbody>
            <tr><td>比特/秒</td><td>:</td><td>b/s 或 bps</td></tr>
            <tr><td>1 kb/s</td><td>=</td><td>$10^{3}$ b/s = 1000 bps</td></tr>
            <tr><td>1 Mb/s</td><td>=</td><td>$10^{6}$ b/s = 1000 kb/s</td></tr>
            <tr><td>1 Gb/s</td><td>=</td><td>$10^{9}$ b/s = 1000 Mb/s</td></tr>
            <tr><td>1 Tb/s</td><td>=</td><td>$10^{12}$ b/s = 1000 Gb/s</td></tr>
          </tbody>
        </table>
      </Tab>

      <Tab title="硬盘和文件">
        <img src="https://mintcdn.com/0907/yO7weug7l78KOEtX/images/computer-architecture/Chapter2_Unit_1.webp?fit=max&auto=format&n=yO7weug7l78KOEtX&q=85&s=84ba794c83aad6ca5bc8e064923f30e8" alt="硬盘和文件容量单位图示 1" width="1150" height="552" data-path="images/computer-architecture/Chapter2_Unit_1.webp" />

        <img src="https://mintcdn.com/0907/yO7weug7l78KOEtX/images/computer-architecture/Chapter2_Unit_2.webp?fit=max&auto=format&n=yO7weug7l78KOEtX&q=85&s=402476d3fb7f6db08fd731c59d1e518f" alt="硬盘和文件容量单位图示 2" width="1158" height="392" data-path="images/computer-architecture/Chapter2_Unit_2.webp" />
      </Tab>
    </Tabs>
  </Accordion>

  <Accordion title="数据的存储和排列顺序">
    * 大端方式：将数据的最高有效字节 `MSB` 存放在低地址单位中
    * 小端方式：将数据的最低有效字节 `LSB` 存放在低地址单位中

    <Tip>
      判断口诀：低地址放高字节是大端，低地址放低字节是小端
    </Tip>

    <Info>
      示例：机器数 `01234567 H`
    </Info>

    <img src="https://mintcdn.com/0907/yO7weug7l78KOEtX/images/computer-architecture/Chapter2_Storage.webp?fit=max&auto=format&n=yO7weug7l78KOEtX&q=85&s=ff37cdafb7d6b5b6a3d2ff1b00c39888" alt="大端与小端存储示意图" width="838" height="230" data-path="images/computer-architecture/Chapter2_Storage.webp" />
  </Accordion>
</AccordionGroup>
