Skip to content

Instantly share code, notes, and snippets.

@camelcaseblog
Last active January 29, 2019 12:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
>>> 0.1 + 0.2 == 0.3
False
>>> def compare(a, b, epsilon=0.00001):
... return abs(a - b) < epsilon
...
>>> compare(0.1 + 0.2, 0.3)
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment