Skip to content

Instantly share code, notes, and snippets.

@camelcaseblog
Last active January 29, 2019 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camelcaseblog/519b5a370980b92e84a92309f50628ae to your computer and use it in GitHub Desktop.
Save camelcaseblog/519b5a370980b92e84a92309f50628ae to your computer and use it in GitHub Desktop.
>>> 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