IEEE 754 恒等律:字面意义和价值改变优化
IEEE 754 identity laws: Literal meaning and value-changing optimizations
IEEE 754-2008 标准表示,对于 0 + x
和 1 * x
等表达式,可以应用标识 属性 (§ 10.4):
Applying the identity property 1 × x when x is not a signaling NaN and the result has the same exponent as x.
我想知道 "the result has the same exponent as x" 是什么意思?
我认为它们是指二进制表示的指数域。
乘以 1 不会改变指数,即使对于 QNaN,即使有效数字(NaN 有效载荷)发生变化。所有 NaN 都具有相同的全一指数编码。 (无穷大是 significand=0 的全一指数;该指数值的编码 space 的全部其余部分都花在了基本上没有人使用的 NaN 有效载荷上。)
对于任何非 NaN,当您乘以 1 时,指数字段不会改变是微不足道的事实。尾数或符号位也不会改变。 (IIRC,1.0 * -0.0 = -0.0
)。
IEEE 754-2008 标准表示,对于 0 + x
和 1 * x
等表达式,可以应用标识 属性 (§ 10.4):
Applying the identity property 1 × x when x is not a signaling NaN and the result has the same exponent as x.
我想知道 "the result has the same exponent as x" 是什么意思?
我认为它们是指二进制表示的指数域。
乘以 1 不会改变指数,即使对于 QNaN,即使有效数字(NaN 有效载荷)发生变化。所有 NaN 都具有相同的全一指数编码。 (无穷大是 significand=0 的全一指数;该指数值的编码 space 的全部其余部分都花在了基本上没有人使用的 NaN 有效载荷上。)
对于任何非 NaN,当您乘以 1 时,指数字段不会改变是微不足道的事实。尾数或符号位也不会改变。 (IIRC,1.0 * -0.0 = -0.0
)。