if (val1 == val2) return true; double diff = (val1 - val2) / (val1 + val2); return (diff < 0.0001 && diff > -0.0001);
return MoreMath.nearlyEquals(val1, val2, 0.0001);
    private boolean isSameRate(Rate rate1, Rate rate2) {        if (rate1 == rate2) return true;        if (rate1 == null || rate2 == null) return false;        double val1 = rate1.getValue(rate1.getCommonUnit());        double val2 = rate2.getValue(rate2.getCommonUnit());        if (val1 == val2) return true;        double diff = (val1 - val2) / (val1 + val2);        return (diff < 0.0001 && diff > -0.0001);    }