本文介绍了在Lua中,#INF和#IND是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对Lua并不陌生.在测试时,我发现了 #INF
/ #IND
.但是,我找不到很好的参考资料来解释它.
I'm fairly new to Lua. While testing I discovered #INF
/#IND
. However, I can't find a good reference that explains it.
什么是 #INF
, #IND
和类似的东西(例如底片),以及如何生成和使用它们?
What are #INF
, #IND
, and similar (such as negatives) and how do you generate and use them?
推荐答案
#INF
是无限的, #IND
是NaN.进行测试:
#INF
is infinite, #IND
is NaN. Give it a test:
print(1/0)
print(0/0)
Windows计算机上的输出:
Output on my Windows machine:
1.#INF
-1.#IND
由于ANSI C中没有这些的标准表示,因此您可能会得到不同的结果.例如:
As there's no standard representation for these in ANSI C, you may get different result. For instance:
inf
-nan
这篇关于在Lua中,#INF和#IND是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!