为什么无穷大×0 = NaN? [英] Why is Infinity × 0 = NaN?

查看:467
本文介绍了为什么无穷大×0 = NaN?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IEEE 754将1/0的结果指定为∞(无穷大).

IEEE 754 specifies the result of 1 / 0 as ∞ (Infinity).

但是,IEEE 754然后将0×∞的结果指定为NaN.

However, IEEE 754 then specifies the result of 0 × ∞ as NaN.

这感觉与直觉相反:为什么0×∞不为0?

This feels counter-intuitive: Why is 0 × ∞ not 0?

  1. 我们可以将1/0 =∞视为z趋于零的1/z极限

  1. We can think of 1 / 0 = ∞ as the limit of 1 / z as z tends to zero

我们可以将0×∞= 0视为0×z的极限,因为z趋于∞.

We can think of 0 × ∞ = 0 as the limit of 0 × z as z tends to ∞.

为什么IEEE标准遵循直觉1.而不遵循直觉2.?

Why does the IEEE standard follow intuition 1. but not 2.?

推荐答案

如果您不认为IEEE 754浮点零和无穷实际上是零或无限,则更容易理解它们的行为.

It is easier to understand the behavior of IEEE 754 floating point zeros and infinities if you do not think of them as being literally zero or infinite.

浮点零不仅代表实数零.它们还表示所有四舍五入到小于最小次正规量的实数.这就是为什么零被签名的原因.如果实际上不是零,那么即使是很小的数字也会有符号.

The floating point zeros not only represent the real number zero. They also represent all real numbers that would round to something smaller than the smallest subnormal. That is why zero is signed. Even tiny numbers do have a sign if they are not actually zero.

类似地,每个无穷大也代表所有具有相应符号的数字,这些符号将舍入到一定范围内的大小.

Similarly, each infinity also represents all numbers with the corresponding sign that would round to something with a magnitude that would not fit in the finite range.

NaN表示无实数结果",例如sqrt(-1),或没有线索".

NaN represents either "No real number result", for example sqrt(-1), or "Haven't a clue".

很大的东西除以很小的东西就非常非常大,所以无穷大/0 ==无穷大".

Something very big divided by something very small is very, very big, so `Infinity / 0 == Infinity".

很大的东西乘以很小的东西就可以了,这取决于我们所不知道的实际大小.由于结果可能很小也可能很大,因此,NaN是最合理的答案.

Something very big multiplied by something very small could be anything, depending on the actual magnitudes that we don't know. Since the result could be anything from very small through very big, NaN is the most reasonable answer.

================================================ ==================

=================================================================

尽管我认为以上是理解实际浮点行为的最佳方法,但在实数限制中也会出现类似的问题.

Although I think the above is the best way to understand practical floating point behavior, a similar issue arises in real number limits.

假设f(x)趋于无穷大,而g(x)趋于零,而x趋于无穷大.容易证明f(x)/g(x)趋于无穷,而x趋于无穷.另一方面,如果没有更多有关功能的信息,就不可能证明有关f(x)*g(x)极限的任何事情.

Suppose f(x) tends to infinity and g(x) tends to zero as x tends to infinity. It is easy to prove that f(x)/g(x) tends to infinity as x tends to infinity. On the other hand, it is not possible to prove anything about the limit of f(x)*g(x) without more information about the functions.

这篇关于为什么无穷大×0 = NaN?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆