问题
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