问HN:在求和中如何可能得到-0.0?

2作者: gus_massa4 天前原帖
我正在寻找结果为 -0.0 的边界情况。根据我的了解,在求和中得到 -0.0 的唯一方法是: ``` (-0.0) + (-0.0) ``` 有没有人知道在 IEEE 754 中还有其他情况? 附加问题:在减法中会发生什么?我只知道: ``` (-0.0) - (+0.0) ``` 还有其他情况吗?
查看原文
I&#x27;m looking for corner cases where he result is -0.0. As far as I know, the only way to get -0.0 in a sum is<p><pre><code> (-0.0) + (-0.0) </code></pre> Does someone know any other case in IEEE 754?<p>Bonus question: What happens in subtractions? I only know<p><pre><code> (-0.0) - (+0.0) </code></pre> Is there any other case?