Created
September 25, 2020 08:45
-
-
Save tlylt/72f08629bfbf3502d3ff1952d3cba7f7 to your computer and use it in GitHub Desktop.
Compare two double in Java
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
boolean closeEnough(double a, double b) { | |
double tolerance = 1E-4; | |
return Math.abs(a-b) < tolerance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment