为什么我从Python Interpreter(2.7.6)和计算器得到不同的结果?

-2 python calculation

我有以下公式:

SZT = SZ0 +(((SZ1-SZ0)/(WMZ1-WMZ0))*(WMZT-WMZ0))

例:

86266 + (((168480 - 86266) / (703786 - 510531)) * (703765.0 - 510531))
Run Code Online (Sandbox Code Playgroud)

当我使用python解释器(2.7.6)进行此计算时,我得到了这个结果:

86266
Run Code Online (Sandbox Code Playgroud)

当我使用计算器(例如谷歌)时,我得到了这个结果:

168471.066239
Run Code Online (Sandbox Code Playgroud)

我假设第二个是正确的结果.

Python中的计算有什么问题?

aka*_*iya 7

基本上Python 2.73.3计算是彼此不同的.

Python的3.3回报0.11/10,而Python 2.7的回报0.您可以使用启用新除法运算符__future__

>>> from __future__ import division
>>> print(86266 + (((168480 - 86266) / (703786 - 510531)) * (703765.0 - 510531)))
168471.066239
Run Code Online (Sandbox Code Playgroud)