Ask HN: 怎么在求和中得到 -0.0?
2 分•作者: gus_massa•10 个月前
我正在寻找结果为 -0.0 的边界情况。据我所知,在加法中得到 -0.0 的唯一方法是:
```
(-0.0) + (-0.0)
```
有人知道 IEEE 754 中还有其他情况吗?
额外问题:减法会发生什么?我只知道
```
(-0.0) - (+0.0)
```
还有其他情况吗?
查看原文
I'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?