Skip to content

Instantly share code, notes, and snippets.

@apiguy
Created October 29, 2013 21:10
Show Gist options
  • Save apiguy/7222667 to your computer and use it in GitHub Desktop.
Save apiguy/7222667 to your computer and use it in GitHub Desktop.
Demonstrates how floats can be inaccurate
time = .0
seconds = 0
while True:
time += .1
seconds = int(time)
print "---------------"
print "Time to str: ", time
print "Time to int: ", int(time)
print "Seconds: ", seconds
if seconds >= 10:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment