Skip to content

Instantly share code, notes, and snippets.

@nathanchen
Created November 4, 2013 08:45
Show Gist options
  • Select an option

  • Save nathanchen/7299816 to your computer and use it in GitHub Desktop.

Select an option

Save nathanchen/7299816 to your computer and use it in GitHub Desktop.
compare two doubles with delta
static private boolean doubleIsDifferent(double d1, double d2, double delta) {
if (Double.compare(d1, d2) == 0) {
return false;
}
if ((Math.abs(d1 - d2) <= delta)) {
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment