Created
November 4, 2013 08:45
-
-
Save nathanchen/7299816 to your computer and use it in GitHub Desktop.
compare two doubles with delta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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