Source Code : Weighted floating-point comparisons

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Weighted floating-point comparisons

         
class WtComp {
  public static boolean equals(double v1, // First argument
      double v2, // Second argument
      double e) // Epsilon
  {
    return Math.abs(v1 - v2) < e;
  }

  public static void main(String[] args) {

    double a = 9.33333333333000;
    double b = 9.33333333333333;
    final double EPSILON = 1.0E-10;

    if (equals(a, b, EPSILON))
      System.out.println("values are equal");
    else
      System.out.println("values are not equal");
  }
}



           
         
    
    
    
    
    
    
    
    
  

Thank with us