calculation - Why do I get different results from Python Interpreter (2.7.6) and a calculator? -


i have following formula:

szt = sz0 + (((sz1 - sz0) / (wmz1 - wmz0)) * (wmzt - wmz0))

example:

86266 + (((168480 - 86266) / (703786 - 510531)) * (703765.0 - 510531))

when use python interpreter (2.7.6) calculation, got result:

86266

when use calculator (google example) got result:

168471.066239

i assume second correct result.

what's wrong calculation in python?

basically python 2.7 , 3.3 calculations different each other.

python 3.3 return 0.1 1/10, while python 2.7 return 0. can enable new division operator using __future__

>>> __future__ import division >>> print(86266 + (((168480 - 86266) / (703786 - 510531)) * (703765.0 - 510531))) 168471.066239 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -