JavaScript/双精度浮点数:修订间差异
来自康健生活
| 第164行: | 第164行: | ||
& 0.5 \times 2 = {\color{Red} 1} & \quad\cdots\quad\text{取 1} & \downarrow \end{aligned}</math> | & 0.5 \times 2 = {\color{Red} 1} & \quad\cdots\quad\text{取 1} & \downarrow \end{aligned}</math> | ||
最后获得结论 <math>(-1) \times (11011 + 0.00101) = -11011.00101</math> | 最后获得结论 <math>(-1) \times (11011 + 0.00101) = -11011.00101</math>。推导过程: | ||
<math>\begin{align} | <math>\begin{align} | ||
(-27.15625)_{10} = (-11011.00101)_2 \\ | (-27.15625)_{10} = (-11011.00101)_2 \\ | ||
= (1100111011001010)_{\text{半精度浮点数}} \\ | = (-1) \times (1.101100101)_{2} \times 2^4 \\ | ||
\because S = -1, E = 4, M = (101100101)_2 | |||
\therefore e = E + 1023 = (1027)_{10} = (100000001)_2 \\ | |||
\Rightarrow (1100111011001010)_{\text{半精度浮点数}} \\ | |||
= (11000001110110010100000000000000)_{\text{单精度浮点数}} \\ | = (11000001110110010100000000000000)_{\text{单精度浮点数}} \\ | ||
= (1100000000111011001010000000000000000000000000000000000000000000)_{\text{双精度浮点数}} | = (1100000000111011001010000000000000000000000000000000000000000000)_{\text{双精度浮点数}} | ||