troubleshooting Question

python type conversion exhibiting unexpected behavior

Avatar of Steve Bink
Steve BinkFlag for United States of America asked on
PythonScripting Languages
12 Comments1 Solution699 ViewsLast Modified:
Can someone please explain why this is?  And more importantly, how to correct it...

$> python
Python 2.6.6 (r266:84292, Sep 12 2011, 14:03:14)
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a='97757589545391667'
>>> a
'97757589545391667'
>>> int(a)
97757589545391667
>>> float(a)
97757589545391664.0
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros