python float got a colon after the decimal point after addition [closed]

元气小坏坏 提交于 2019-11-28 04:46:32

问题


In my python program, I got two floating numbers -2901.0, -200.0 during some process. When I tried to add them directly I got -3100.: (If I converted it to str, it would be "-3100.:")

Python didn't say any error in the program. But the result always carry the colon after the decimal and is not correct (I am expecting -3101.0).

I can't reproduce it by simply entering -2901.0-200.0 in python command line. However, if I continue to add other non-zero values, it goes through (-3100.:-1 , it gives -3102.0). But I hope to correctly output/interpret -3100.:

I am running on Python2.7 32 bit. I've numpy, scipy and a few other packages installed. Does any one know what is wrong here? Why am I getting a colon, when I expected a number?

  • Windows server 2008 64 bit.
  • sys.version: 2.7.3 (default, Apr 10 2012, 23:31:26)
  • MSC v.1500 32 bit (Intel)

Thank you very much.

来源:https://stackoverflow.com/questions/13825487/python-float-got-a-colon-after-the-decimal-point-after-addition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!