JavaScript/双精度浮点数:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
无编辑摘要
 
(未显示同一用户的3个中间版本)
第416行: 第416行:
0.5 \times 2 = 1 & \quad\cdots\quad\text{取整 1 } & \downarrow \end{aligned}</math>
0.5 \times 2 = 1 & \quad\cdots\quad\text{取整 1 } & \downarrow \end{aligned}</math>


精度损失,比如 <math>(0.3)_{10} = (0.0\overline{1}\overline{0}\overline{0}\overline{1})_2</math>。
精度损失,比如 <math>(0.3)_{10} = (0.0\overline{1001})_2</math>。


<math>\begin{align}
<math>\begin{align}
(0.3)_{10} = 0.010011001100110011001 \cdots \\
(0.3)_{10} = 0.010011001100110011001 \cdots \\
= 0.0\overline{1}\overline{0}\overline{0}\overline{1}
= 0.0\overline{1001}
\end{align}</math>
\end{align}</math>


第457行: 第457行:
<math>
<math>
\begin{array}{l}  
\begin{array}{l}  
0.1 = (-1)^0 \times 1.1\overline{0}\overline{0}\overline{1}\overline{1} \times 2^-4 \\
0.1 = (-1)^0 \times 1.1\overline{0011} \times 2^-4 \\
0.2 = (-1)^0 \times 1.1\overline{0}\overline{0}\overline{1}\overline{1} \times 2^-3
0.2 = (-1)^0 \times 1.1\overline{0011} \times 2^-3
\end{array}
\end{array}
</math>
</math>
第466行: 第466行:
<math>
<math>
\begin{array}{l}  
\begin{array}{l}  
0.1 \Rightarrow S = 0, M= 1.1 \overline{0}\overline{0}\overline{1}\overline{1}, E = -4 \\
0.1 \Rightarrow S = 0, M= 1.1 \overline{0011}, E = -4 \\
e = (-4 + 1023)_{10} = (1019)_{10} = (1111111011)_2 \\
e = (-4 + 1023)_{10} = (1019)_{10} = (1111111011)_2 \\
0.2 \Rightarrow S = 0, M= 1.1 \overline{0}\overline{0}\overline{1}\overline{1}, E = -3 \\
0.2 \Rightarrow S = 0, M= 1.1 \overline{0011}, E = -3 \\
e = (-3 + 1023)_{10} = (1020)_{10} = (1111111100)_2
e = (-3 + 1023)_{10} = (1020)_{10} = (1111111100)_2
\end{array}
\end{array}
第490行: 第490行:
<math>
<math>
\begin{array}{r}  
\begin{array}{r}  
0.1 = 1.1\overline{0}\overline{0}\overline{1}\overline{1} * 2^{-4} \\
0.1 = 1.1\overline{0011} * 2^{-4} \\
     = 0.11\overline{0}\overline{0}\overline{1}\overline{1} * 2^{-3} \\
     = 0.11\overline{0011} * 2^{-3} \\
0.2 = 1.1\overline{0}\overline{0}\overline{1}\overline{1} \times 2^{-3}
0.2 = 1.1\overline{0011} \times 2^{-3}
\end{array}
\end{array}
</math>
</math>