This commit is contained in:
krahets
2023-08-19 19:21:18 +08:00
parent 97c532b228
commit 71c7786f51
22 changed files with 49 additions and 8 deletions
@@ -21,6 +21,7 @@ comments: true
- 整数类型 `int` 占用 $4$ bytes = $32$ bits ,可以表示 $2^{32}$ 个数字。
下表列举了各种基本数据类型的占用空间、取值范围和默认值。此表格无需硬背,大致理解即可,需要时可以通过查表来回忆。
<p align="center"> 表:基本数据类型的占用空间和取值范围 </p>
<div class="center-table" markdown>
@@ -144,6 +144,7 @@ $$
**尽管浮点数 `float` 扩展了取值范围,但其副作用是牺牲了精度**。整数类型 `int` 将全部 32 位用于表示数字,数字是均匀分布的;而由于指数位的存在,浮点数 `float` 的数值越大,相邻两个数字之间的差值就会趋向越大。
进一步地,指数位 $E = 0$ 和 $E = 255$ 具有特殊含义,**用于表示零、无穷大、$\mathrm{NaN}$ 等**。
<p align="center"> 表:指数位含义 </p>
<div class="center-table" markdown>