Python 2.x 与 Python 3.x 除法运算的区别

Python 2.x 与 Python 3.x 除法运算的区别

strong@foreverstrong:~$ python
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> fps = 15.6
>>> fps
15.6
>>> 
>>> int(fps + 1) / 3
5
>>> 
>>> (fps + 1) / 3
5.533333333333334
>>> 
>>> exit()
strong@foreverstrong:~$
strong@foreverstrong:~$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> fps = 15.6
>>> fps
15.6
>>> 
>>> int(fps + 1) / 3
5.333333333333333
>>> 
>>> (fps + 1) / 3
5.533333333333334
>>> 
>>> exit()
strong@foreverstrong:~$
上一篇:FPS游戏方框透视的实现原理


下一篇:Unity 之 OnGUI实时显示游戏FPS...