Skip to content

Instantly share code, notes, and snippets.

@searls
Created September 14, 2011 20:26
Show Gist options
  • Save searls/1217683 to your computer and use it in GitHub Desktop.
Save searls/1217683 to your computer and use it in GitHub Desktop.
# http://stackoverflow.com/questions/588004/is-javascripts-math-broken
beforeEach ->
this.addMatchers
toPrettyMuchEqual: (number) ->
return Math.abs(this.actual - number) < 0.000001
@krsmes
Copy link

krsmes commented Sep 15, 2011

kinda like python unittest's assertAlmostEqual(a, b) : round(a-b, 7) == 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment