Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. import org.apache.commons.math3.util.Precision;
  2.  
  3. public class PrecisionTest {
  4.    
  5.    
  6.     public static void main(String[] args) {
  7.        
  8.        
  9.         double x = 4.0;
  10.         double y = -1.0;
  11.        
  12.         boolean isEqual = Precision.equals(x, y , 10E-14);
  13.         System.out.println(isEqual);
  14.        
  15.         System.out.println(Precision.compareTo(x, y , 10E-14));
  16.        
  17.         System.out.println(x==y);
  18.        
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement