Example usage for com.google.common.math DoubleMath fuzzyCompare

List of usage examples for com.google.common.math DoubleMath fuzzyCompare

Introduction

In this page you can find the example usage for com.google.common.math DoubleMath fuzzyCompare.

Prototype

public static int fuzzyCompare(double a, double b, double tolerance) 

Source Link

Document

Compares a and b "fuzzily," with a tolerance for nearly-equal values.

Usage

From source file:org.eclipse.elk.alg.layered.compaction.oned.CompareFuzzy.java

public static boolean gt(final double d1, final double d2) {
    return DoubleMath.fuzzyCompare(d1, d2, TOLERANCE) > 0;
}

From source file:org.eclipse.elk.alg.layered.compaction.oned.CompareFuzzy.java

public static boolean lt(final double d1, final double d2) {
    return DoubleMath.fuzzyCompare(d1, d2, TOLERANCE) < 0;
}

From source file:org.eclipse.elk.alg.layered.compaction.oned.CompareFuzzy.java

public static boolean ge(final double d1, final double d2) {
    return DoubleMath.fuzzyCompare(d1, d2, TOLERANCE) >= 0;
}

From source file:org.eclipse.elk.alg.layered.compaction.oned.CompareFuzzy.java

public static boolean le(final double d1, final double d2) {
    return DoubleMath.fuzzyCompare(d1, d2, TOLERANCE) <= 0;
}

From source file:brooklyn.location.jclouds.BrooklynImageChooser.java

protected static int compare(double left, double right) {
    return DoubleMath.fuzzyCompare(left, right, 0.00000001);
}

From source file:com.teradata.tempto.internal.query.QueryResultValueComparator.java

private int doubleEqual(Object actual, Object expected) {
    if (isFloatingPointValue(actual) && isFloatingPointValue(expected)) {
        Double actualDouble = Double.valueOf(actual.toString());
        Double expectedDouble = Double.valueOf(expected.toString());
        Double threshold = expectedDouble * DOUBLE_FUZZY_MATCH_THRESHOLD;
        return DoubleMath.fuzzyCompare(actualDouble, expectedDouble, threshold);
    }/* w  w w .j  a  v a2s .  c  om*/
    return -1;
}