@Test public void acompareDoublesWithTol() { double tol = 0.01d; double x1 = 100; double x2 = x1 - tol / 10; assertEquals(0, CompareOp.acompare(x1, x2, tol)); x2 = x1 - tol * 10; assertTrue(CompareOp.acompare(x1, x2, tol) > 0); x2 = x1 + tol * 10; assertTrue(CompareOp.acompare(x1, x2, tol) < 0); }
public static int acompare(double x1, double x2) { if (isZero(x1 - x2)) { return 0; } else { return Double.compare(x1, x2); } }
CompareOp { public static int acompare(double x1, double x2) { if (isZero(x1 - x2)) { return 0; } else { return Double.compare(x1, x2); } } }
CompareOp { public static int acompare(double x1, double x2) { if (isZero(x1 - x2)) { return 0; } else { return Double.compare(x1, x2); } }  }
CompareOp { public static int acompare(double x1, double x2) { if (isZero(x1 - x2)) { return 0; } else { return Double.compare(x1, x2); } }  static boolean isZero(double x); static boolean isZero(float x); static boolean isZero(double x, double tol); static boolean isZero(float x, float tol); static int acompare(double x1, double x2); static int acompare(float x1, float x2); static int acompare(double x1, double x2, double tol); static int acompare(float x1, float x2, float tol); static int pcompare(double x1, double x2, double propTol); static int pcompare(float x1, float x2, float propTol); static boolean aequal(double x1, double x2); static boolean aequal(float x1, float x2); static boolean aequal(double x1, double x2, double tol); static boolean aequal(float x1, float x2, float tol); static boolean pequal(double x1, double x2, double propTol); static boolean pequal(float x1, float x2, float propTol); }
CompareOp { public static int acompare(double x1, double x2) { if (isZero(x1 - x2)) { return 0; } else { return Double.compare(x1, x2); } }  static boolean isZero(double x); static boolean isZero(float x); static boolean isZero(double x, double tol); static boolean isZero(float x, float tol); static int acompare(double x1, double x2); static int acompare(float x1, float x2); static int acompare(double x1, double x2, double tol); static int acompare(float x1, float x2, float tol); static int pcompare(double x1, double x2, double propTol); static int pcompare(float x1, float x2, float propTol); static boolean aequal(double x1, double x2); static boolean aequal(float x1, float x2); static boolean aequal(double x1, double x2, double tol); static boolean aequal(float x1, float x2, float tol); static boolean pequal(double x1, double x2, double propTol); static boolean pequal(float x1, float x2, float propTol); static final double DTOL; static final float FTOL; }