Skip to content

Instantly share code, notes, and snippets.

@bleis-tift
Created September 21, 2016 23:48
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 bleis-tift/25967bc60c426e9260603ace083f7882 to your computer and use it in GitHub Desktop.
Save bleis-tift/25967bc60c426e9260603ace083f7882 to your computer and use it in GitHub Desktop.
type FloatEq = FloatEq of float * float
let (=.) a b = FloatEq (a, b)
let (<+->) (FloatEq (a, b)) e = abs (a - b) < e
10.3 =. 9.9 <+-> 0.5 // => true
10.3 =. 9.9 <+-> 0.1 // => false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment