static int compareAsDoublesWithTolerance(final Val val1, final Val val2) {
        final Double d1 = val1.toDouble();
        final Double d2 = val2.toDouble();

        if (d1 != null
            && d2 != null
            && Math.abs(d1 - d2) < DOUBLE_TOLERANCE_FRACTION * Math.abs(d2)) {
            return 0;
        } else {
            return AS_DOUBLE_COMPARATOR.compare(val1, val2);
        }
    }
This is to deal with the

@param val1
@param val2
@return
stroom-query/stroom-query-language/src/main/java/stroom/query/language/functions/ValComparators.java