Is 0 divided by infinity guaranteed to be 0?

一个人想着一个人 提交于 2019-12-07 13:30:57

问题


According to this question, n/inf is expected to be zero for n != 0. What about when n == 0? According to IEEE-754, is (0 / inf) == 0 always true?


回答1:


Mathematically, 0/0 is indeterminate, and 0/anything_else is zero. IEEE-754 works the same way.

So 0/infinity will yield a zero. 0/0 will yield a NaN.

Note: not all C++ implementations support IEEE floating point, and some that do so don't completely meet IEEE specifications, so this is not necessarily a C++ question.



来源:https://stackoverflow.com/questions/29426734/is-0-divided-by-infinity-guaranteed-to-be-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!