static boolean equalWithinTolerance(long left, long right, long tolerance) {
    try {
      // subtractExact is always desugared.
      @SuppressWarnings("Java7ApiChecker")
      long absDiff = Math.abs(subtractExact(left, right));
      return 0 <= absDiff && absDiff <= Math.abs(tolerance);
    } catch (ArithmeticException e) {
      // The numbers are so far apart their difference isn't even a long.
      return false;
    }
  }
@Test
  public void equalsDifferentTypes() {
    assertThat(equalWithinTolerance(1.3d, 1.3f, 0.00000000000001d)).isFalse();
    assertThat(equalWithinTolerance(1.3f, 1.3d, 0.00000000000001f)).isFalse();
  }