有无限整数吗? [英] Is there an infinite integer?

查看:177
本文介绍了有无限整数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一种游戏,我的位置可以在整数中变化。例如:



I am currenty developing a game where my position can change in an integer. For instance:

Player.X -= Player.WalkingSpeed;





现在我假设整数是无限的,但为了确保,我做了一个快速的谷歌检查,发现这个:



< a href =http://msdn.microsoft.com/en-us/library/5kzh1b5w%28v=vs.80%29.aspx> http://msdn.microsoft.com/en-us/library/5kzh1b5w %28v = vs.80%29.aspx [ ^ ]



这告诉我一个整数范围从-2,147,483,648到2,147,483,647。有什么方法可以制作一个(我的)整数(所以它)不停在-2,147,483,648和2,147,483,647?



编辑:欢迎任何其他解决方案,但我需要它是一个整数,因为我不能使用双打。



Now I presumed that the Integer was infinite, but to make sure, I did a quick google check and found this:

http://msdn.microsoft.com/en-us/library/5kzh1b5w%28v=vs.80%29.aspx[^]

Which is telling me that an integer ranges from -2,147,483,648 to 2,147,483,647. Is there any way I can make an(my) integer (so it)that does not stop at -2,147,483,648 and 2,147,483,647?

Any other solutions are welcome to, but I need it to be a whole number since I can not use doubles.

推荐答案

没有。而且不需要它。但你可以使用正负无穷大而不是浮点类型的数字,并用这些值进行值算术。







请参阅: http://en.wikipedia.org/wiki/IEEE_754 [ ^ ]。



-SA
No. And it is not needed. But you can use positive and negative infinity and not-a-number with floating-point types and do value arithmetic with those values.



Please see: http://en.wikipedia.org/wiki/IEEE_754[^].

—SA


没有无限整数,但可以使用Long。其区间为负9,223,372,036,854,775,808,为正9,223,372,036,854,775,807。这是正负九元素。
There is not an infinite integer, but you can use a Long. Its range is negative 9,223,372,036,854,775,808 to positive 9,223,372,036,854,775,807. That is plus or minus nine quintillion.


这篇关于有无限整数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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