gpt4 book ai didi

floating-point - IEEE 754 标准中哪里指定了 `Inf * 0` 的结果?

转载 作者:行者123 更新时间:2023-12-04 07:46:03 25 4
gpt4 key购买 nike

IEEE 754-2019 标准的第 6.1 节规定:

The behavior of infinity in floating-point arithmetic is derived from the limiting cases of real arithmetic with operands of arbitrarily large magnitude, when such a limit exists. Infinities shall be interpreted in the affine sense, that is: −∞ < {every finite number} < +∞.


但是,在我使用过的所有实现中 Inf * 0 = NaN ,这似乎与引用的文本相矛盾。
IEEE 754 标准中的哪里是 Inf * 0 的结果指定的?

最佳答案

IEEE 754-2008 7.2 说:

The invalid operation exception is signaled if and only if there is no usefully definable result. In these casesthe operands are invalid for the operation to be performed.

For operations producing results in floating-point format, the default result of an operation that signals the invalid operation exception shall be a quiet NaN that should provide some diagnostic information (see 6.2). These operations are:


b) multiplication: multiplication(0, ∞) or multiplication(∞, 0)


754-2019 的接近最终草案在上面引用的部分中是相同的。

关于floating-point - IEEE 754 标准中哪里指定了 `Inf * 0` 的结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67190231/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com